I'm a very new programmer going through the O'Reilly book Learning PHP & MySQL 2nd ed. by Michele Davis & Jon Phillips. This is being stored on my home ubuntu server.
I'm stuck on ex 11-28 where they want me to upload a picture and move it from tmp to an uploads folder if it meets certain conditions: file size, type, and whether or not it was uploaded.
The code is at the link below but with .txt instead of .php. Having a hard time getting it to show up.
When I hit the submit button w/o there being a file in the file box, I get the following warning:
Warning: unlink() [function.unlink]: No such file or directory in /home/luna/public_html/learn_php/up_urs.php on line 10
When I submit a file bigger than maxsize I get my error msg:
Error. File must be less than 28480 bytes.
When I submit a file of the wrong type I get my error msg:
You may only upload .gif & .jpg files.
When I submit a file that's the right type & size I get the following warning and my OK msg:
Warning: move_uploaded_file(learn_php/uploads/) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/luna/public_html/learn_php/up_urs.php on line 21
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/php4Mhykl' to 'learn_php/uploads/' in /home/luna/public_html/learn_php/up_urs.php on line 21
Thanks for your upload.
I thought the problem was with permissions but changing the directory learn_php to 777 made no difference so I changed it back to 755.
Then I tried changing the path from "uploads" to "/home/luna/public_html/learn_php/uploads"
& that didn't fix it.
I tried to use getcwd() before & after the unlink & move_uploaded_file
commands but that only told me I was in learn_php...
I tried uncommenting the //print_r($_FILES);
but that didn't show me anything after pressing submit.
Not sure what to look for now. Thanks for any help :)