PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
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.
So then it should be putting the image in the folder specified then right? If for some reason it couldn't see the folder, wouldn't it throw an error. Thanks for the help feyd
Well I know the folder is there. So I put it in an if statement and the function is returning false. Can you look at my statement and tell if I have it right?
$iname = mysql_insert_id();
echo $iname; // I have this here just to make sure it wasn't null
if(!move_uploaded_file($_FILES["file"]["tmp_name"], "uploads/" . $iname)) { echo "failed"; }
else { echo "success"; }
Ahhh yeah, well, I was just about to say thanks for the help. And you can call me stupid now. I guess before you upload a file you should make sure it has permission to do so. Sorry guys. But one more question, it saved it as a binary file. Is that right even though it was a jpeg? Just wondering if I'll still be able to display on a page as a jpeg. Thanks again.