HI
Ich habe hier diese upload script welches ich von einem freund habe:
Jezt möchte ich es gerne so machen das der Name der Datei die geuploadet wurde in eine DB eingetragen wird. Ein code habe ich dafür auch schon gebaut.
Jezt habe ich ein Probleme ich will den code in DB einbauen.
Ich habe es an verschieden stellen eingebaut aber die Seite wo man uploaden soll ich dan immer nur noch weiss: http://www.pbulletin.de/jakob/bild.php
Könnt ihr mir helfen und mir sagen wo der code hin muss damit die seite nicht weiss ist??
Philipp
Ich habe hier diese upload script welches ich von einem freund habe:
Code:
<? include("dbconnect.php"); $abpath = "bilder"; //Wohin mit den bildern $sizelim = "no"; //File limit, yes or no $size = "2500000"; //Wenn ein Limt wie hoch $number_of_uploads = 1; //Wie viele Uploads gleichzeitig if ($_REQUEST['submitted']){ // Begin processing portion of script //erlaubte typen zum uploaden $cert1 = "image/pjpeg"; //Jpeg type 1 $cert2 = "image/jpeg"; //Jpeg type 2 $cert3 = "image/gif"; //Gif type $cert4 = "image/ief"; //Ief type $cert5 = "image/png"; //Png type $cert6 = "image/tiff"; //Tiff type $cert7 = "image/bmp"; //Bmp Type $cert8 = "image/vnd.wap.wbmp"; //Wbmp type $cert9 = "image/x-cmu-raster"; //Ras type $cert10 = "image/x-x-portable-anymap"; //Pnm type $cert11 = "image/x-portable-bitmap"; //Pbm type $cert12 = "image/x-portable-graymap"; //Pgm type $cert13 = "image/x-portable-pixmap"; //Ppm type $cert14 = "image/x-rgb"; //Rgb type $cert15 = "image/x-xbitmap"; //Xbm type $cert16 = "image/x-xpixmap"; //Xpm type $cert17 = "image/x-xwindowdump"; //Xwd type $log = ""; for ($i=0; $i<$number_of_uploads; $i++) { //checks if file exists if ($img_name[$i] == "") { $log .= "No file selected for upload $i "; } if ($img_name[$i] != "") { //checks if file exists if (file_exists("$abpath/$img_name[$i]")) { $log .= "File $i already existed "; } else { //checks if files to big if (($sizelim == "yes") && ($img_size[$i] > $size)) { $log .= "File $i was too big "; } else { //Checks if file is an image if (($img_type[$i] == $cert1) or ($img_type[$i] == $cert2) or ($img_type[$i] == $cert3) or ($img_type[$i] == $cert4) or ($img_type[$i] == $cert5) or ($img_type[$i] == $cert6) or ($img_type[$i] == $cert7) or ($img_type[$i] == $cert8) or ($img_type[$i] == $cert9) or ($img_type[$i] == $cert10) or ($img_type[$i] == $cert11) or ($img_type[$i] == $cert12) or ($img_type[$i] == $cert13) or ($img_type[$i] == $cert14) or ($img_type[$i] == $cert15) or ($img_type[$i] == $cert16) or ($img_type[$i] == $cert17)) { @copy($img[$i], "$abpath/$img_name[$i]") or $log .= "Couldn't copy image 1 to server "; if (file_exists("$abpath/$img_name[$i]")) { $log .= "File $i was uploaded "; } } else { $log .= "File $i is not an image "; } } } } } ?> <html> <head> <title>Upload/title> </head> <body> Log: <? echo "$log"; ?> </p> <body> </html> <? exit; } // End processing portion of script ?> <html> <head> <title>Upload Image</title> </head> <body> <form method=POST action=bild.php enctype=multipart/form-data> Files to upload: <? for ($j=0; $j<$number_of_uploads; $j++) { ?> <input type=file name=img[] size=30> <? } ?> <input type="hidden" name="submitted" value="true"> <input type="submit" name="submit" value="Upload"> </form> </body> </html>
Jezt möchte ich es gerne so machen das der Name der Datei die geuploadet wurde in eine DB eingetragen wird. Ein code habe ich dafür auch schon gebaut.
Code:
$name = $img_name[$i] $eintrag = "INSERT INTO bilder (name) VALUES ('".$name."')"; $eintragen = mysql_query($eintrag) OR DIE (mysql_error());
Jezt habe ich ein Probleme ich will den code in DB einbauen.
Ich habe es an verschieden stellen eingebaut aber die Seite wo man uploaden soll ich dan immer nur noch weiss: http://www.pbulletin.de/jakob/bild.php
Könnt ihr mir helfen und mir sagen wo der code hin muss damit die seite nicht weiss ist??
Philipp
Kommentar