File Upload question, file doesn't show up on success
Posted: Wed Apr 04, 2007 11:25 pm
I know that subject line doesn't logically make since, but here's my situation. I have a file upload function that supposed to upload an image to a folder on the server called uploads. When I hit the submit button the process goes through like it should. But when I look in the folder, the image is not there. When I use the move_uploaded_file function, am I supposed to use an absolute address to the folder with http://somewhere.com/uploads/ ?
My http folder has the upload file along with the uploads folder. So I don't think I have to step out or anything. I appreciate all the help you guys give us newbs.
My http folder has the upload file along with the uploads folder. So I don't think I have to step out or anything. I appreciate all the help you guys give us newbs.
Code: Select all
if ($_FILES["file"]["error"] > 0)
{
echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
}
else
{
$sql = "INSERT INTO images (imagenum, usernumber,imagename,category,public)
values (null,'$usernumber','$imagename','$category','$public')";
if (!mysql_query($sql,$connection)) {
die('Error: ' . mysql_error());
}
else {
$success = "Upload Successfull";
move_uploaded_file($_FILES["file"]["tmp_name"],
"uploads/" . mysql_insert_id()); // <---- question here
}
}