If you are seeing any of the following errors when you try to upload/import media into WordPress’s media library then this tutorial is for you. It will show you how to fix this annoying error.
- Unable to create directory wp-content/uploads
- Unable to create directory /wp-content/uploads/ Is its parent directory writable by the server?
- Unable to create directory wp-content/uploads/2013/02
I personally faced this issue a while back and wrote a quick fix tutorial on this subject. However, a lot has changed since then so it is time to publish an updated version of the tutorial.
There are a few different possibilities for this error to show up. I will try to cover all the possibilities so hopefully one of them will help you fix the issue.
Fix #1: Update/Change the Uploads Directory Settings
This is the easiest option to try and solve this error so you should try this one first.
- Log into your WordPress admin dashboard
- Go to Media Settings menu (Settings -> Media)
- Enter wp-content/uploads in the “Store uploads in this folder” text box
- Save the changes by hitting the “Save Changes” button and you are done
The important thing here is to make sure you only enter the following in the “Store uploads in this folder” field:
wp-content/uploads
Fix #2: Manually Change the Folder Permission
If the above fix doesn’t work then try this option. This method requires you to change the file/folder permissions on your server. If you don’t know how to do this then read the tutorial on how to change permissions.
- Change folder permissions on the wp-content directory to 775 and try the upload again
- If it fails, change the permissions to 777 and try again
- if it still fails then do step 1 and 2 for the “wp-content/uploads” directory too
Once you can successfully create the folder and upload the media, be sure to return the permissions on wp-content directory to 755 (your folders should have a permission of 755 for security reasons).
Fix #3: Use This If Your Server is Using Ubutu
The webserver (Apache) runs as user www-data and group www-data by default on a Ubuntu system. If the files/folders are not owned by this user (www-data) then the webserver will be unable to write changes to them.
Change the filesystem permission on the folder (where the web application wants to write to) to the “parent directory” as mentioned in the error message.
For example, do (prepend with sudo if you’re not the current owner and need to elevate your own permissions in order to do it):
chown www-data /path/to/directory
to make www-data the owner which makes it writeable usually, or another approach via groups:
chgrp www-data /path/to/directory
chmod g+w /path/to/directory
Fix #4: Try This If Running PHP in Safe Mode
If your server is running PHP in safe mode then know that it won’t allow you to create files or directories if your PHP scripts and upload directories belong to different users. So try one of the following solutions:
- Change the owner of scripts and upload directories (your hosting provider can do this for you)
- Disable PHP safe mode (your hosting provider can do this for you)
Fix #5: Use This for XAMPP (LocalHost Installs)
If you have installed XAMPP to run WordPress on your local PC for testing and you are seeing this error then try the following.
Reset the ownership of the WordPress instillation to nobody. You can do this by running the a command in the command line/terminal.
- Windows System: Start -> Programs -> Accessories -> Command Prompt
- Mac:Â Applications ->Utilities -> Terminal
sudo chown -R nobody:staff /applications/xampp/xamppfiles/htdocs/wp
Hopefully one of the above solutions should help you fix the unable to create directory error in WordPress.
If none of the above solution works then maybe it is time to look for another hosting provider for your WordPress site.
Please feel free to share any other techniques/fixes for this error in the comment section below.
I use “chmod 777 folderdirectory/wp-content -v” it’s work on Linux Mint. Thanks for the tutorial.
Thank You SO Much!
I’ve been struggling with this problem for over a YEAR! Updraft Backup would NOT work the whole time, so I had to manually do backups, as other backup solutions would not work either. Other Themes (the now deprecated Aspen, replaced by Weaver Extreme) and plugins (Main WP Child) had similar issues.
I tried your Solution # 2 first, resetting permissions, and then I tried Solution #1. I think I’ve tried the permissions reset a number of times in the past, and did not work, so it might have been #1 that saved the day. But not thinking to be sufficiently scientific about it (I just wanted it FIXED) I tried permissions first, then did settings/media, but did not turn permissions back down before trying #1.
Sorry about that!
Regardless, this has been a BIG help! Your site is bookmarked and I’ll now look for what else you’ve got too.
Thank You Very Much & Take Care,
David Scott Lynn
None of the above suggestions fixed the issue I was having. I am currently running XAMPP installation on a local host. I tried the following command sudo chown -R nobody:staff, however, it gave invalid user. I replaced nobody:staff with the PC user of the machine but that did not help either. Any suggestions would be greatly appreciated as I’m still dealing with the problem,
Came across this in the serps, my problem was solved within the minute. Thanks a lot for saving me a lot of time (presumably :D).
Fix 1 worked for me at chugabags. After i had checked so many forums
Fixed with #1, thank you so much for your tutorial….such a simple fix for an aggravating problem.
Solved it with Fix #1 tank you
Thanks so much for Tip #3; it was unreasonably effective
Fix #1 worked perfect!!!.
Thanks
Fix #2 working for me, thanks you 🙂
Thank you so much #1 worked perfect and I was up and running in 5 minutes. So great to have great help when you need it and not search for hours.
This also threw me for a loop years ago when I set up my site, but the solution was different. If you have a new or especially secure implementation of many ftpd server packages, the ability to write is disabled by default. For example, vsftpd disables being able to write to the file system by default, regardless of permissions. You have to enable it. Ensure you have set this up or your hosting provider has. vsftpd.conf for example:
# Uncomment this to enable any form of FTP write command.
write_enable=YES
I switched to ssh and keys since then but I I’ll never forget that lost hour or three…
Fix #1 worked beautifully. I had recently changed my hosting and I was trying to upload a plugin when I got that “Unable to create directory… message” I thought I was about to end up spending forever trying to figure it out, but within about 15 minutes I found this site and saw what your readers were saying.
They were right. Thank you so much. Plain english, wp beginner can understand.
Thanks you so much!
I have been searched for solution for a whole day, and Fix #5 really fixed my problems.
谢谢!
If you need to alter the permissions of ‘wp-content’ folder to 777 to make things work then you need to understand that permissions need to be tweaked.
You cannot keep 777 which will allow any user to access the folder.
So always keep your permission to 755 but check the ownership of the folder.
The owner should be the owner of the service executing the script.
In the case of a conventional apache service we would have the apache user.
So,
$ sudo chown apache:apache -R wp-content
This should help out!
Thanks fix #1 worked perfect!!!
Thank you very much. I had ubuntu and my www folder was set to “root” user. I changed it to “www-data”. It worked like charm.
I knew there was something to it about changing between hosts. I just didn’t know where to look! Obviously Fix#1 from you fixed it.
Thank you for this!
Thanks so much for taking the time to share your knowledge. This problem was driving me crazy as it was on a subdomain installation I used your Fix #1 above and all my frustration and stress just simply disappeared. Thanks again for sharing your knowledge.
Thank you so much. The First one worked for my website. Appreciate your cooperation. 🙂
Thank you very much. This was the solutions (Fix #1) that worked for my localhost installation with xampp on Windows 7. It’s a pitty that most solutions that you find on google are all about editing code (define(‘FS_METHOD’, ‘direct’);) to the wp-config.php and changing permissions.
I had the same issue with the latest wp-update. WP nor plugins would auto-update.
None of the solutions mentioned here worked. What did work was:
– deactivate all plugins,
– put the rights all to 777,
– check for the wp-config (change the rights settings to 0777 there as well)
– do a manual ftp upgrade of WP,
– do a auto-upgrade of the still deactivated plugins,
– reactivate the plugins and
– put the rights to the previous settings (folders, files and wp-config).
I don’t know why this works, but it is the second site that had this problem, and it worked twice.
Thanks so much for taking the time to share your knowledge. This problem was driving me crazy as it was on a subdomain installation I used your Fix #1 above and all my frustration and stress just simply disappeared. Thanks again for sharing your knowledge.
Thank you for publishing this. I found the problem emerged when I changed webhosts. The media settings were specific to my previous host.
i.e /oldusername/website/wp-content/uploads
It worked like a charm. I was wondering for long for this. Thanks
Fix #1 fixed the problem for me.
Thanks!
Thanks for the options to fix this. I had installed an old version of WP a while ago and then updated it recently… after which I was unable to upload images. Your Fix number #1 solved my problem in an instant!! After I spent an hour or so looking around for a solution elsewhere. Many thanks!
Thank you for the fix! Worked like a charm.
Thank you for taking the time to post the tips.
I did your recommended fix #1 which required me to delete a single extra backslash at the beginning of “(/)wp-admin/uploads” and that fixed the frustrating problem. Cheers!
Thank you so much for this article, fixed my problems right away!
Thank you very much for this great tutorial. This was easy to understand and i was able to fix this directory creation problem that has been frustrating me for hours.
Brilliant Site..Thanx, went through a lot of site but I couldn’t get the help I needed. Found it here…Keep up the good work…
If your server is running PHP in safe mode then know that it won’t allow you to create files or directories if your PHP scripts and upload directories belong to different users.