Hi I am really frustrated because I got my php code working fine and then I had to make some minor changes to my html form and now the php is not working. I am reciec=ving this message:
Warning: move_uploaded_file(upload/carey.bmp) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/content/19/6550319/html/ipad/listing.php on line 35
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpIEUQLo' to 'upload/carey.bmp' in /home/content/19/6550319/html/ipad/listing.php on line 35
Sorry, there was a problem uploading your file.03/10/11 : 20:50:08
I wrote it twice because it keeps coming out twice. I guess it means that it cant upload the image because there is no image but I really dont understand why. I havent changed the image part of the form. Does anyone have any ideas? It is much appreciated.
Here is the code
<?php
//This is the directory where images will be saved
$target = "upload/";
$target = $target . basename( $_FILES['photo']['name']);
//This gets all the other information from the form
$price=$_POST['price'];
$pic=($_FILES['photo']['name']);
$pic2=($_FILES['phototwo']['name']);
$pic3=($_FILES['photothree']['name']);
$pic4=($_FILES['photofour']['name']);
$description=$_POST['iPadDescription'];
$condition=$_POST['condition'];
$gig=$_POST['giga'];
$yesg=$_POST['yesg'];
$fname=$_POST['firstName'];
$lname=$_POST['lastName'];
$email=$_POST['email'];
// Connects to your Database
mysql_connect ("taken out for security", "taken out", "taken out") or die(mysql_error()) ;
mysql_select_db("taken out") or die(mysql_error()) ;
//Writes the information to the database
mysql_query("INSERT INTO ipadlist (price,photo,phototwo,photothree,photofour,iPadDescription,condition,giga,yesg,firstName,lastName,email)
VALUES ('$price', '$pic', '$pic2', '$pic3', '$pic4', '$description', '$condition', '$gig', '$yesg', '$fname', '$lname', '$email')") ;
//Writes the photo to the server
if(move_uploaded_file($_FILES['photo']['tmp_name'], $target))
{
//Tells you if its all ok
echo "The file ". basename( $_FILES['uploadedfile']['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.";
}
echo date("m/d/y : H:i:s", time())
?>