note 80679 added to features.file-upload
| From: | xsence at gmail dot com | Date: | Mon, 28 Jan 2008 19:40:52 +0000 |
| Subject: | note 80679 added to features.file-upload | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-135493@lists.php.net to get a copy of this message | ||
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.";
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 213.17.25.53
----
Manual Page -- http://www.php.net/manual/en/features.file-upload.php
Edit -- https://master.php.net/note/edit/80679
Del: integrated -- https://master.php.net/note/delete/80679/integrated
Del: useless -- https://master.php.net/note/delete/80679/useless
Del: bad code -- https://master.php.net/note/delete/80679/bad+code
Del: spam -- https://master.php.net/note/delete/80679/spam
Del: non-english -- https://master.php.net/note/delete/80679/non-english
Del: in docs -- https://master.php.net/note/delete/80679/in+docs
Del: other reasons-- https://master.php.net/note/delete/80679
Reject -- https://master.php.net/note/reject/80679
Search -- https://master.php.net/manage/user-notes.php