Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1
    Join Date
    May 2005
    Posts
    139
    Plugin Contributions
    0

    Default Image Upload Error - permission denied

    Hello,

    I am getting the error below when I am trying to upload an image for a new product.

    Warning: move_uploaded_file(D:/inetpub/website/perfume/images/bw.jpg): failed to open stream: Permission denied in D:\inetpub\website\perfume\admin\includes\classes\upload.php on line 112

    Warning: move_uploaded_file(): Unable to move 'C:\PHP\uploadtemp\php17CD.tmp' to 'D:/inetpub/website/perfume/images/bw.jpg' in D:\inetpub\website\perfume\admin\includes\classes\upload.php on line 112

    I read through other posts and the common answer was "CHMOD your permissions to 777". I am on a windows server so the process is slightly different, but I have set the permissions to read, write and execute for the whole admin directory and it still doesn't work. I even tried uninstalling and reinstalling the whole cart, same result.

    I am using the most up-to-date version of zen-cart by the way.


    ***Additonal note since posting: I applied read, write and execute to the entire cart, and the uplaod works now. By having this applied to the entire cart, is the cart at risk in anyway?

  2. #2
    Join Date
    Feb 2006
    Location
    Chicago
    Posts
    1,162
    Plugin Contributions
    0

    Default Re: Image Upload Error - permission denied

    Is php.ini set for the upload directory?
    Can you use this function in general? Or is it just here that you are getting the error

  3. #3
    Join Date
    May 2005
    Posts
    139
    Plugin Contributions
    0

    Default Re: Image Upload Error - permission denied

    Hey superprg,

    Thanks for the reply. When you say is php.ini set for the directory, how do I check that?

    I am also working on another shopping cart with the same host and having the same problem.

    The first one I mentoined works fine now because I gave 777 permissions throughout the entire cart.

    The second only has these permissions applied to the:
    - includes folder in the admin directory
    - includes folder in the main directory.
    - cache folder in the main directory.

    I haven't sent the permissions to 777 for sub folders below those.

    I tried uploading an image to the main category section, and while I didn't get an error, it also didn't upload the image.

  4. #4
    Join Date
    Feb 2006
    Location
    Chicago
    Posts
    1,162
    Plugin Contributions
    0

    Default Re: Image Upload Error - permission denied

    Quote Originally Posted by quantum
    Hey superprg,

    Thanks for the reply. When you say is php.ini set for the directory, how do I check that?

    I am also working on another shopping cart with the same host and having the same problem.

    The first one I mentoined works fine now because I gave 777 permissions throughout the entire cart.

    The second only has these permissions applied to the:
    - includes folder in the admin directory
    - includes folder in the main directory.
    - cache folder in the main directory.

    I haven't sent the permissions to 777 for sub folders below those.

    I tried uploading an image to the main category section, and while I didn't get an error, it also didn't upload the image.
    What is the value of upload_tmp_dir in php.ini?

  5. #5
    Join Date
    May 2005
    Posts
    139
    Plugin Contributions
    0

    Default Re: Image Upload Error - permission denied

    Hi,

    I worked out what php.ini is and ran it:

    upload_tmp_dir - C:\PHP\uploadtemp

    Is this the info you are looking for?

  6. #6
    Join Date
    Feb 2006
    Location
    Chicago
    Posts
    1,162
    Plugin Contributions
    0

    Default Re: Image Upload Error - permission denied

    Quote Originally Posted by quantum
    Hi,

    I worked out what php.ini is and ran it:

    upload_tmp_dir - C:\PHP\uploadtemp

    Is this the info you are looking for?
    Yes,
    Is permission for this file 777?

    Also, please run the function move_uploaded_file seperately and see if it runs properly

  7. #7
    Join Date
    May 2005
    Posts
    139
    Plugin Contributions
    0

    Default Re: Image Upload Error - permission denied

    Hello,

    I don't have access to C:\PHP\uploadtemp to check the permissions.

    To run function move_uploaded_file, do I need to install something else? I searched on this in the cart and it only appears as some code in the upload.php file (which doesn't run on its own) and not anywhere else.

    Also, if applying 777 permissions to the whole cart folder fixes the problem, wouldn't it likely be that it is a permissions problem within the cart folder and not with the server?

  8. #8
    Join Date
    Feb 2006
    Location
    Chicago
    Posts
    1,162
    Plugin Contributions
    0

    Default Re: Image Upload Error - permission denied

    You dont have to install anything to test move_upload_file

    Try this

    my.html

    <form enctype="multipart/form-data" action="uploader.php" method="POST">
    <input type="hidden" name="MAX_FILE_SIZE" value="100000" />
    Choose a file to upload: <input name="uploadedfile" type="file" /><br />
    <input type="submit" value="Upload File" />
    </form>


    uploader.php:

    $target_path = "uploads/";

    $target_path = $target_path . basename( $_FILES['uploadedfile']['name']);

    if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
    echo "The file ". basename( $_FILES['uploadedfile']['name']).
    " has been uploaded";
    } else{
    echo "There was an error uploading the file, please try again!";
    }

  9. #9
    Join Date
    May 2005
    Posts
    139
    Plugin Contributions
    0

    Default Re: Image Upload Error - permission denied

    I get the following error message: "There was an error uploading the file, please try again!"

  10. #10
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: Image Upload Error - permission denied

    Quote Originally Posted by quantum
    I have set the permissions to read, write and execute for the whole admin directory and it still doesn't work. I even tried uninstalling and reinstalling the whole cart, same result.

    ***Additonal note since posting: I applied read, write and execute to the entire cart, and the uplaod works now. By having this applied to the entire cart, is the cart at risk in anyway?
    Yes, you are putting yourself at risk.
    Only the folders mentioned in the installation screens and the installation docs need to be set to read/write/execute.

    Here are some tips on securing your site further:
    http://www.zen-cart.com/wiki/index.p...ecommendations


    If you're having trouble uploading images via the Admin, then your /images folder and subfolders are the place to look for permissions being set to read/write/execute.
    You could also upload them via FTP...
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. permission denied error
    By Muzz in forum Installing on a Linux/Unix Server
    Replies: 4
    Last Post: 5 May 2010, 11:59 PM
  2. Replies: 4
    Last Post: 12 Apr 2010, 11:09 PM
  3. Picture upload error message: move_uploaded_file Permission denied
    By Billd in forum Customization from the Admin
    Replies: 2
    Last Post: 21 May 2008, 08:29 AM
  4. Error uploading images via admin - permission denied on Windows host
    By ronwong in forum Setting Up Categories, Products, Attributes
    Replies: 24
    Last Post: 6 Oct 2006, 05:13 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg