File Upload error

Posted on 2011-05-03
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
    LVL 11

    Expert Comment

    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:

    Author Comment

    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

    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

    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

    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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
    I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
    Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

    737 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

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now