Today I moved one of my site to a new server and when I tried uploading an image I got this error :
Unable to create directory /wp-content/uploads/2009/09. Is its parent directory writable by the server?
The parent directory is 2009 and uploads is ‘super’ parent directory (if I can call it that way). Both the directories had 777 permission so there was nothing wrong with the permission settings.
The problem was not with the directory permissions, but it was with URL where WordPress was trying to upload the image.
On my previous server, I had the blog in a folder named ‘tech’ and in the new server I had renamed it as ‘technology’.
Since I had moved the complete blog to the new server, the upload path was pointing to :
/home/tech/public_html/wp-content/uploads/2009/09
instead of pointing to
/home/technology/public_html/wp-content/uploads/2009/09
Do you notice the source of the problem ?
How can you fix it ?
Simple,
Login to your Blog as admin, go to Miscellaneous under Settings.
You’ll find the option “Store uploads in this folder” Set it to default which is “wp-content/uploads“, unless u specifically want the content in some other folder.
This should solve your problem !
There is a more complicated way of changing the file upload path of your wordpress blog, this is recommended only for those who know how to handle wp-config file !
For this you’ll have to modify wp-config.php file. Add below mentioned code before
require_once(ABSPATH.’wp-settings.php’); code in your wp-config file
define(‘UPLOADS’, ‘wp-content/new_folder’);
Once you save this new configuration all your uploaded files will go to the ‘new_folder’ under wp-content directory.
Thanks for the solution, its the important part with permission issues to check.
@Merv
Thanks..really its help me..
thxx it’s solved
oh yes, that’s ironic – at least it didn’t strip the space after define which I think is still useful.
I wonder if this will work?:
define ('UPLOADS', 'wp-content/new_folder');
@Tom – Thanks. Guess the default wordpress editor changed it to a quote.
define(‘UPLOADS’, ‘wp-content/new_folder’);
did NOT work for me. Perhaps you can change this to
define (‘UPLOADS’, ‘wp-content/new_folder’);
(the difference is the single quote is an apostraphe!
thank you master
hehe .. finally I was able to upload photos
thanks it worked for me,
eep up the good work
Wuhuu! Thanks a lot. I too found your link in the WP-forum 🙂
hi, just came to say thank you. I found your link in wordpress forum
Thanks heaps – this solution worked for me. Appreciate you sharing this.
The fix worked. and a HUGE THANK YOU to Merv – I was lost and then read your comment. Fixed quickly when located. Thanks .
Thanks for the new location
This helped. Thank you.
Thanks for the tips. I moved my blog from one server to another and your tip fixed the problem. But the fix is located in settings > Media. not “Miscellaneous” in WP 3.1
Thanks, it worked for me!!! I had that error when trying to load the /wp-admin page, so the only fix that worked was “the more complicated way”.
Keep up the good work
Hi, where can i find the wp-config.php? i face this Is “its parent directory writable by the server?”
i’ve tried the 1st method but it does not work ><
This solution worked. Thanks
Make sure that your php safe mode is “OFF”. Problem will then be solved. Good luck all.
Thank you so much for this solution! I was banging my head against the wall trying to figure out why it was looking at the wrong directory when I was installing the plugin. You saved me hours of work 🙂
@Jessen – Welcome.
Removing the slash really works. I am glad to find this post. Thanks!
@Les – May be what you suggest works, but doesn’t mean that this doesn’t work out. I’ve experienced this problem and this solution worked for me. It has helped a lot of others who’ve commented about the same.
This was the worst advice possible. Just check your storage limits and see if you have exceeded them. This is probably the case! Don’t change your WP-CONFIG file – this will screw some shit up for sure!
Thanks a bunch,
This was driving me crazy, ultimately I had the same problem someone else did.
I transferred my blog to a new hosting company. I had /wp-config..
Same thing I should have only had wp-config without the slash when I made the change it worked.
That was really help, i had that problem too before..
thx for ur share.
i write it too with my language.
http://www.tipstrikkomputer.com/wordpress-error-tidak-bisa-upload-gambar.html
Thank you very much! I was desperate to solve this problem until see your site.Changing code is really useful for me. Thxxxxxxxxxxxxxxxxxxxxx
Thanks for the tips. It really works!!!
Awesome! After lots of searching this worked. My host must have swapped the website from home/ to home2/ !!
Cheers for the solution.
For me I had to make sure the file was there. It was under wp-content/uploads and i didn’t have that file. I got rid of the /uploads and it worked!
@andy – if there’s no content, then it surely will save your time if you install everything from fresh. Sounds like a better option at this point when you are not able to find the right solution.
I guess i’m next to jump on the wagon. Working on my dad’s site and having this issue. I’ve double checked all spelling and punctuation. I’ve deleted folders and tried again, i’ve tried different names. I’ve made sure all permissions were set to 777 for every folder in the hierarchy of the blog (i’ve done this through Fillezilla and then even logged into his Plesk Control Panel, and checked in their file manager). I modified the wp-config.php file, which for some reason didn’t do anything. It didn’t change directories or anything. Not sure if stuff has changed since we just upgraded to WP3. Anymore ideas?? He doesn’t have any post, so should I just try killing everything and reinstalling?
thanks for any help
@Melissa – Glad it helped you. For a newbie, it becomes a mystery handling these things the first time. Next time around, you’ll surely solve your problems much quicker 🙂
Thank you, thank you, thank you! I’m new to WordPress, CSS, and PHP and I could not figure out what was going on. Solved my problem right away. 🙂
changing wp-content/uploads permission to 777 fixed mine.
@Atur – Glad you found the post informative.
Thanks, the blog is Informative and very helpful
my problem when upload thumbnails is..
The uploaded file could not be moved to /var/www/vhosts/webwisepreview.com/httpdocs/demosite/wordpress/wp-content/uploads.
anyone can help?
everything is 777
I had this problem and spent several hours reading posts about with no luck. My permissions were right and the upload folder path was correct.
I realised that it was a SELinux issue for me. If you run SELinux then you will need to run the command below to allow apache (httpd) to execute particular PHP commands, including creating new files and folders. Here is the command:
chcon -R -t httpd_sys_content_t
Hope that helps someone else. This was driving me crazy and I was about ready to give up and uninstall WordPress. Glad it didn’t come to that.
THX MAN U AWESOME 🙂
geeeez! all the problem was that it should say “wp-content/uploads” and NOT “/wp-content/uploads”
that off the “/” in the beginning. what a world of hurt because of that slash.
Thanks! This saved me a lot of time and aggravation. I kept trying to change all variations of 777 permissions for my upload folders etc and was pulling my hair out. awesome post.
All is in Setings > Miscellaneous > type correct path to folder….
thanks 😛
I have the same problem…I changed the permissions to 777. I checked the path and its correct and I did the above and got the error:
Warning: Division by zero in /Library/WebServer/Documents/wordpress/wp-config.php on line 77.
Any more solutions?
I have done all the tips above, but it still doesn’t work.
And now , on top of it appear “Warning: Division by zero in /home/a4866193/public_html/wp-config.php on line 76”
Have any other idea?
@Jitendra
@Zoubayda
If messing with the wp-config.php still doesn’t do it, go to the Admin Dashboard, Settings, Miscellaneous, and delete the wp-content/uploads and untick organize by month/day. Save the changes.
Then, add new post, insert image, go back to Miscellaneous. tick the organize by month/day. Save the changes. Hope it works. 🙂
@Zoubayda – Have you checked the directory path – Most of the time it is the directory path that is not right, even a small spelling mistake can create this problem. If you are sure that the Directory path is correct, then please use the second method of over-writing your wp-config file and it will definitely solve your problem. Make sure you take a back up of wp-config file before you edit it, you’ll need it just in case some thing goes wrong.
If you still have problem, please do get back and lets see what can be done. According to me there should be no problem.
Cheers.!
please i need help
i am facing problem …that i can’t upload small imagine or video om my wordpress blog i am receiving this error:
for upload image error is
Unable to create directory /var/www/vhosts/zoubaydasoudi.com/httpdocs/wp-content/uploads/2009/11. Is its parent directory writable by the server?
i have check the L Miscellaneous under Settings.
You “Store uploads in this folder” Set it to default which is “wp-content/uploads“,
…
Which version of WP are u using Jeremie ? strange that you encounter a problem when u try to link an image ! never face such an issue… may be it’s temporary .. may be the WordPress installation files are corrupt for some reason .. May be taking a back-up of the database and re-installing wordpress fresh might help. Not really sure what the problem is !… Can you tell me when was the first time you experience this problem ? Did you move your blog to a new server and since then experiencing this problem ?
I’ve tried all the tips list above and nothing works for me.
I can’t upload photos and when I’m navigating the Add Image pop-up (where you can either upload, use an outside link, or go to your media library) to add an image from the media library it gives me a 404-ish OOPS! Page Not Found.
I’ve double checked the default folders and permissions and nothing seems to be working. HELP!
Thank you Gautam for the answer.
Worked out. the folder had to be named “uploads” and not “Upload” as I did and the permissions where to be 777.
Then for the importing I had to retry several times, untill all the images were imported.
(http://myblog.files.wordpress.com/2009/09/dscn8364.jpg… Remote file error: Remote server did not respond)
Thanks.
@Jonas – I think the problem is with the URL. Have u tried following all the steps mentioned in the post ? I had a similar problem, and realized that the directory was pointing to old structure and not the new one. Once I changed the path to the correct, current directory everything worked fine. I suggest, you must try playing around with the directory path and that should solve your problem, or best is to follow the steps mentioned in the post, it should solve your problem. If the problem still persists, let me know and we can dig deep and see what the actual problem is.
@Rosaleen,Gautam – Same problem here. I started WP new on my server and wanted to import my wordpress.com blog. However it keeps telling me:
“Unable to create directory /home/httpd/vhosts/blog.jonas/httpdocs/wp-content/uploads/2009/11. Is its parent directory writable by the server?”
Any ideas? – Thank you!
@Rosaleen – Is your blog on the main domain or subdomain or any other sub-folder ? The above options should work, if nothing works, modifying the wp-config file should definitely work. Let me know if the problem still persists, we can do a remote session and figure the problem out.
Cheers.
eeek..this hasnt worked for me. i’ve tried a few folders (wp-content/uploads, /wp-content/uploads, http://myaddress.com/wp-content/uploads, etc) but nothing…
i had also tried changing the permissions on the folders and that didn’t work either. any other ideas?
@Gilank – Welcome
Thanks, your tutorial for this code -> define(’UPLOADS’, ‘wp-content/new_folder’);
very useful once again thanks from indonesia 🙂
Thanks for the post. This worked perfectly for me. DreamHost switched servers on me but the root directory didn’t get changed properly.
@Jitendra – If you use the first method, then you don’t need to tamper wp-config.php. Try using the first option and if you still continue to face problems, then try the second method listed. If you have issues with either, please get back !
Thanks
PHP Error Message
Warning: Division by zero in /home/xxxxxxx/public_html/wp-config.php on line 81
line 81
define(’UPLOADS’, ‘wp-content/uploads’);
help please
Hi Gautam,
Thanks for the tip,by the way what if I am storing my images in another folder say img.domainname.com?
Posting images in above said folder is working fine with WLW but not with WP.Any clues?
thanks! been cracking my brain on how to fix this. hehehe
Thanks, saved me loads of time figuring what was wrong when trying to do an import
@Googleverse – But server looks for files based on absolute or relative path. Under what circumstance would it look / search for files ? An example would be …
Simple. Server has not to search for theme files inside large folder. Server utilization is reduced as it knows where to look.
@Googleverse – care to explain how it effects performance. Curious. Thanks.
One tip . I would like to give is that make some CUSTOM folders inside uploads folder. And in that custom folder you can keep really large files, big theme images and other things. Now after some time when your upload folder becomes considerably large (in 4-5 years), the number of items wont affect the performance.