Hallo, ich hab mir aus dem Internet ein script zum Hochladen von Bildern oder anderen Files aus dem Internet geladen, das Script wollte ich so veraendern, das er den Filenamen direkt in die Datenbank einspeichert, also mit mySql
Ich poste mal den Code
PHP
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>HD Uploader</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="100%" cellspacing="2" cellpadding="2" height="100%">
<tr>
<td>
<div align="center">
<table width="550" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#336699">
<tr>
<td background="bg.gif"><table width="100%" cellpadding="5" cellspacing="5">
<tr>
<td background="bg.gif">
<form name="formen" action="upload/uploader.php" method="post" enctype="multipart/form-data">
[list=1]
[*]Daten duerfen max 1000kb gross sein
[*]Daten duerfen nur das Untenstehende Dateiformat haben
[*]Daten muessen unten einen Dateinamen bekommen
[/list]
<table width="100%" cellspacing="2" cellpadding="2">
<tr>
<td width="180" background="bg.gif">File: </td>
<td background="bg.gif">
<input type="file" name="bilde_fil">
</td>
</tr>
<tr>
<td width="180" background="bg.gif">Choose folder:</td>
<td background="bg.gif">
<select name="folder">
<option>Choose folder</option>
<option value="uploaded_pics/">Uploaded Pics</option>
<option value="uploaded_files/">Uploaded Files</option>
<option value="uploaded_docs/">Uploaded Docs</option>
</select>
</td>
</tr>
<tr>
<td width="180" background="bg.gif">Name of the file
on the server:</td>
<td background="bg.gif">
<input type="text" name="nyttnavn">
</td>
</tr>
<tr>
<td width="180" background="bg.gif">Filetype:</td>
<td background="bg.gif">
<select name="ending">
<option>.jpg</option>
<option>.png</option>
<option>.gif</option>
<option>.exe</option>
<option>.zip</option>
<option>.rar</option>
<option>.ace</option>
<option>.html</option>
</select>
</td>
</tr>
</table>
<input type="submit" value="Upload" name="submit">
<input type="hidden" name="MAX_FILE_SIZE" value="1000000">
<?php if ($folder == "Choose folder")
{
echo "[b]Error: [/b] You must Choose a folder to upload your file.";
}?>
<?php
#Config
$path=$folder; //The file-path(remember the last '/')
#Do not edit below :)
if ($bilde_fil && $nyttnavn){
$ok = 1;
if (is_file($path.$nyttnavn.$ending)){
print "[b]Error[/b], the name allready exists. Choose another name.
";
$ok = 0;
}
if (preg_match("/^[\/\\\.]/", $nyttnavn)){
print "[b]Error[/b], Filname can't start with: '.', '/' or '\'";
$ok = 0;
}
if (!($ending == ".jpg" || $ending == ".gif" || $ending == ".zip" || $ending == ".exe" || $ending == ".rar" || $ending == ".html" || $ending == ".ace" || $ending == ".png")){
print "[b]Error[/b], do not mix with the filename ($ending) Thanks!";
$ok = 0;
}
print "";
}
if ($ok){
$res = copy($bilde_fil, $path."/".$nyttnavn.$ending);
print ($res)?"[b]Finish[/b], uploadet ".$nyttnavn.$ending."":"[b]Error[/b], could not upload the file.
";
print "";
}
?>
<font color="#00000">959390752072342378218374</font>
</form>
</td>
</tr>
</table> </td>
</tr>
Alles anzeigen
ich geh mal davon aus, das man irgendwie $path speichern muss, aber ich hab echt keine Ahnung wie das Funktioniert.
Kann mir dabei jemand helfen, das ggf. Umschreiben?!
Ihr waert mir wirklich ne Riesenhilfe, ganz ehrlich
Liebe Gruesse, Guenther