Support » Fixing WordPress » 'Unable to create directory /wp-content/uploads.'

  • Resolved srhoden


    I am getting the error listed above whenever I try to upload images via the Media tab. I am running on a LAMP setup, specifically on Ubuntu. I’ve tried all of the solutions that I have found and so far, none of them have worked. Things I’ve tried: I’ve changed the permissions of the wp-content folder to 777. (I’ll downgrade the permissions to a safer setting after this problem is solved.) I’ve tried changing the group owner of the uploads folder to www-data as seen in this solution ( I’ve deleted the .htaccess file and resaved the permalinks setting. I’ve tried changing the uploads path in wp-config.php.

    At this point I have no clue what to try. If anybody has an idea of what I need to do to get this to work it would be greatly appreciated.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Create the directory “wp-content/uploads” yourself, do it at the command prompt. Then with “sudo” set its owner and permissions to writeable by the Apache daemon, make it world readable and searchable.

    Alright I tried doing what you suggested but it still isn’t working. I did all of the following from the terminal. First I went into the wp-content directory and removed the uploads folder. Then I recreated the uploads folder and entered

    sudo chgrp www-data uploads/

    Next I did

    chmod g+w uploads/

    and then finished by doing

    chmod 775 uploads/

    I tried uploading a couple of different images and get the same error each time.

    Any other ideas as to what might be going on?

    If you do a “chmod 777 uploads”, does this fix it ? Since you are on localhost this is not that dangerous.
    If it does not fix it then something else is amis.
    If it does fix it, then pls check what user the Apache is running as.

    I just did that and then tried uploading a few different images and still no luck. I went ahead and looked into


    and it says `export APACHE_RUN_USER=www-data
    export APACHE_RUN_GROUP=www-data`

    I right clicked on the uploads folder to double-check who owns it and right now the owner says Me and the group is www-data. I tried changing the owner to www-data as well but that didn’t work either.

    Is there anything in the Apache log files ?
    Is there anything in the WordPress / php error logs ?
    Try and enable debugging to get more info, locate the WP_DEBUG line in your wp-config.php file, comment it out and add:

    error_reporting(E_ALL); ini_set('display_errors', 1);
        define( 'WP_DEBUG', true);

    Thanks for working with me on this so far. My wp-config.php file had this:

    /* Set debug mode based on current ENV */

    define( ‘WP_DEBUG’, true );
    define( ‘WP_DEBUG_LOG’, true ); // Stored in wp-content/debug.log
    define( ‘WP_DEBUG_DISPLAY’, true );

    define( ‘SCRIPT_DEBUG’, true );
    define( ‘SAVEQUERIES’, true );

    } else if ( WP_STAGING_SERVER ) {

    define( ‘WP_DEBUG’, true );
    define( ‘WP_DEBUG_LOG’, true ); // Stored in wp-content/debug.log
    define( ‘WP_DEBUG_DISPLAY’, false );

    } else {

    define( ‘WP_DEBUG’, true );

    I looked for a debug.log file in wp-content but found nothing. Then I commented all that out and added the code you posted. I deliberately changed a function name to get an error, and it did show the error directly on the page in the browser, so I think I set it up correctly. When trying to upload the images it still just shows the same error as before though.

    I’m not sure exactly where the error logs are located, but I think I found the apache logs that we want. Inside the directory


    are a lot of access.log and error.log files. I opened the first error log called error.log but there doesn’t seem to be anything related to the problem in there. It goes all the way up to error.log.52.gz so I checked a few more logs out and still didn’t see anything that seemed relevant.

    Alright so I finally fixed it by changing the uploads path in wp-config.php from

    define( ‘UPLOADS’, ‘/wp-content/uploads’ );


    define( ‘UPLOADS’, ‘../wp-content/uploads’ );

    I’m not quite sure why this worked and I thought I had already tried it, but I’m glad I can finally upload images. Thanks Ross for helping me out with this issue.


Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘'Unable to create directory /wp-content/uploads.'’ is closed to new replies.