note 80679 rejected from features.file-upload by nlopess

From: Date: Tue, 29 Jan 2008 12:14:24 +0000
Subject: note 80679 rejected from features.file-upload by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-135537@lists.php.net to get a copy of this message
Note Submitter: xsence at gmail dot com ---- Howto make the following script work? i want to store a maximum of 5 file paths to the mysql server. <?php //This is the directory where images will be saved $target = "images/"; $target = $target . basename($_FILES['foto[]']['name']); //This gets all the other information from the form $street=$_POST['street']; $type=$_POST['type']; $foto1=($_FILES['foto']['name']); $foto2=($_FILES['foto']['name']); $foto3=($_FILES['foto']['name']); $foto4=($_FILES['foto']['name']); $foto5=($_FILES['foto']['name']); // Connects to your Database mysql_connect("localhost", "root", "root") or die(mysql_error()) ; mysql_select_db("test") or die(mysql_error()) ; //Writes the information to the database mysql_query("INSERT INTO test VALUES ('$street', '$type', '$foto1','$foto2','$foto3','$foto4','$foto5')") ; //Writes the photo to the server if(move_uploaded_file($_FILES['foto']['tmp_name'], $target)) { //Tells you if its all ok echo "The files ". basename( $_FILES['foto']['name']). " has been uploaded, and your information has been added to the directory"; } else { //Gives and error if its not echo "Sorry, there was a problem uploading your file."; } ?>

« previous php.notes (#135537) next »