Can’t upload images due to permissions error

For some reason when I try to upload an image to my blog I get an error message saying that WP can’t create a folder under the relevant directory (wp-content/uploads/2010/09) and it’s asking if the folder above it has write permissions.
The parent folder indeed has write permissions. I tried creating the folder manually and it still shows the same error message.

Related posts

Leave a Reply

6 comments

  1. @Lea,

    This error happens when PHP (WordPress) can’t write to the file. This is caused by not having write permissions or the username or group that PHP (WordPress) is running under doesn’t have permission to write to the file.

    755 permissions will allow WordPress write permissions when PHP is running as the username under most shared host plans.

    Some FTP programs will allow you to change the user and group assigned to the folders. You can also make this change using Cpanel’s file manager.

    The folders should have the same username as your Cpanel account.

    Some server environments require you to use 777 permissions for PHP to have write access. This is not secure in a shared hosting environment. You can change your permissions to 777 temporarily to see if that allows you to upload photos but MAKE SURE YOU CHANGE THEM BACK TO 755 WHEN YOUR DONE.

    Your hosting provider should also be able to provide help in this situation.

  2. This seems to be a common problem. I’ve dealt with it a while ago too. In my case, all of the proper directories had 777 permissions. Here is my solution, along with a bunch of others that I’ve tried:

    • In my situation, I had to make sure the FTP user account I was using for WordPress had read/write/execute access. Inexplicably, the original user account had its permissions reset, perhaps by the web host or something. We were never able to determine what caused this change. Using an admin account, we were able to upload images without issues again.

    These tips come from a thread from WordPress support for WP 2.5 (you can refer to the link for more info on any of these items):

    • Make sure you uploaded all the WordPress files correctly.
    • Clear your browser cache, restart your browser.
    • Update your Adobe Flash to the latest version (esp you Linux users!)
    • Disable your plugins and see if the buttons appear. If so, reactivate one by one until they don’t appear any more.
    • Upgrade all your plugins as well.
    • The highly popular Bad Behavior plugin breaks the uploader. Upgrade it to 2.0.14 (or later).
    • mod_security might be causing problems. Disable it to see if that is the problem.
    • Try a smaller image, in pixels. Filesize is largely irrelevant, it’s the width and height of the image that matters.
    • Sometimes the problem is with the image itself. WordPress uses the normal PHP functions for working with images, which are in the “GD” library. GD has problems with certain types of images. One particular image type that it cannot handle is grayscale images. If your image is black and white or grayscale, then make sure that it’s a FULL COLOR image.
    • A new issue in WordPress 2.6 occurs when you have a custom directory for file uploads. The upload will work, but the link/thumbnail link will be wrong and so the image won’t appear.
    • Do you have custom settings on the Settings->Miscellaneous screen? If so, make sure that they are correct. The upload directory must not have a leading slash in front of it (uploads instead of /uploads), and the URL must not have a slash at the end of it.
  3. This fixed it for me: I was logged into WordPress using the user name I created when installing instead of my original cpanel user name that had proper permissions on my account. I fixed the issue by creating a new WordPress admin user using the same username and password as my cpanel user. Logged out and back in as that user and problem solved.

  4. Try uploading the images using FTP software and see if it gives same error.

    Also check if there is any plugin auto-creating a thumbnail of the image uploaded in some other directory

    Also try changing the default file upload location in case this error insists on showing up

    Hope any of this helps (:

  5. One thing that occurred to me – WP will tell you that it can nto copy file to /wp-content/upload even when all permissions are right…. if

    upload_max_filesize

    in php.ini is too small (say 2M and you try to upload 3.5MB file)!

    Hope that helps all thsoe who have right permissions but still can not upload!