View Full Version : move_uploaded_file: failed to open stream
03-02-2007, 05:06 PM
I receive this message when I try to upload an image to my website . Does anyone know what it means and can you give me a basic step by step guide in how to resolve the problem? I am computer illiterate!!:mad: :mad: :mad:
Warning: move_uploaded_file(adverts/72ef761e130ea1d31be300277b9956dbjpg) [function.move-uploaded-file]: failed to open stream: Permission denied in /home/artscraf/public_html/upload.php on line 29
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpy7BgjF' to 'adverts/72ef761e130ea1d31be300277b9956dbjpg' in /home/artscraf/public_html/upload.php on line 29
03-02-2007, 06:43 PM
It means move_uploaded_file() failed to move the file because the filename was wrong or permissions don't allow it to. Try using the full path for the destination ie. /home/artscraf/public_html/adverts/72ef761e130ea1d31be300277b9956dbjpg
You could also get this error if the file exists and the permissions don't allow writing by the user that php is running as(because move_uploaded_file will overwrite existing files, which is why you should always check to see if the file_exists()).
03-02-2007, 08:01 PM
I would like to add a couple of notes as well.
First off, your permissions may not be set on the folder you are attempting to move it into. You need to ensure that the chmod (http://ca3.php.net/manual/en/function.chmod.php) of the folder you are working in has write permissions for the owner and system. If you are on a windows IIS, this does not apply.
Secondly, I'd strongly recommend moving into folders that are above your public_html. This allows you just that one extra step to ensure safe files prior to delivering them to the client. If you need an example of this, I believe that firepages actually has one on his site - a masked jpg file that tricks the processor into believing its an image, but is actually a php script.
Thats my 2 cents
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.