note 36906 added to function.move-uploaded-file
| From: | adam at supervoters dot com | Date: | Sun, 26 Oct 2003 21:16:22 +0000 |
| Subject: | note 36906 added to function.move-uploaded-file | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-59347@lists.php.net to get a copy of this message | ||
I've just wasted an afternoon troubleshooting this problem - maybe I can save someone else the
trouble. I was using this function to save an uploaded file to my server:
move_uploaded_file($filename, "images/testimage.jpg");
But when I tried to view the file in the browser, it would give me a 403 error. I checked the
permissions on the newly-uploaded file and found that they were set differently than the permissions
for the other, accessible files on my server. I had to run a chmod on the file after I did the
move_uploaded_file like so:
move_uploaded_file($filename, "images/testimage.jpg");
chmod("images/testimage.jpg", 0644);
This eliminated my 403 error. Hope this helps someone.
----
Manual Page -- http://www.php.net/manual/en/function.move-uploaded-file.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+36906
Delete -- http://master.php.net/manage/user-notes.php?action=delete+36906&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+36906&report=yes
Search -- http://master.php.net/manage/user-notes.php