Learn how to a build a cloud-first strategyRegister Now


File Upload error

Posted on 2011-05-03
Medium Priority
Last Modified: 2014-07-20
Hello When I am trying to execute the file upload code, I am getting the following error. I have attached the file upload php code in the attachment.
How can I solve this error?

The error is:

Results: File Upload

Warning: move_uploaded_file(/web/users/k0171569/RAY_junk/tsunami4.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in /web/users/k0171569/inc/fupload.php on line 125

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpa8oayT' to '/web/users/k0171569/RAY_junk/tsunami4.jpg' in /web/users/k0171569/inc/fupload.php on line 125

ERROR: RAY_junk/tsunami4.jpg NOT SAVED - SEE WARNING FROM move_uploaded_file() COMMAND
Question by:krutarth941
  • 3
  • 2
LVL 11

Expert Comment

ID: 35515997
You need to set sufficient write permissions on /web/users/k0171569/RAY_junk/.

If you are using IIS and Windows set write permissions on the folder for the IIS worker process user. If you are using Apache and Linux then use the CHMOD command to change the permissions.

CHMOD examples for your issue can be found here: http://www.astahost.com/info.php/Problem-Move_uploaded_file_t18152.html

Author Comment

ID: 35516048
Hello brutaldev, thanks for the information.
I am using windows. Could you please explain me in brief about how to set write permission?
LVL 11

Expert Comment

ID: 35516091
No problem, it's actually quite easy in Windows. To avoid a long winded explanation just follow the instructions in this article or for a more visual guide check this page. The steps may be slightly different in newer versions of Windows but the concepts remain the same and the articles are specific to PHP as well so it's in the right context.

Author Comment

ID: 35516402
Hello brutaldev,I am trying to set the folder permission.
However,In the security tab of the folder,  Internet Guest account and launch IIS process account options are not abailable.
What should I do in this case?
LVL 11

Accepted Solution

brutaldev earned 2000 total points
ID: 35516783
Step 1: If the specific user does not appear in the list then add it. If the Add button does not appear you may have to click the Edit button first.
 Security tabStep 2: Click the advanced button to search for the user on the local machine (if you know the full name skip this)
 Advanced option or type in the nameStep 3: Just click Find Now and look for IIS_IUSRS in the list. The location should be your machine name.
 Find the IIS_IUSRS userStep 4: Click OK on the screenshot from Step 2.
Step 5: Set the Modify and Write permissions for the user you just added.
Set the correct write permissions for the user

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses
Course of the Month21 days, 7 hours left to enroll

804 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question