When attempting to upload files via the WordPress admin to your blog you might receive the below error. This error can be caused for a couple different reasons of which the main reason relates to permissions. Resolving the issue is a security risk but depending on how convenient you want it to be to upload files will depend on if you should use the WP admin or if you should just FTP the files to your blog site.
Error: WordPress File Upload Error: The uploaded file could not be moved to /wordpress/root/wp-content/uploads/2009/04
Below I list two different causes and resolutions for each one.
- File Permissions: This is the most common issues and is caused because the WordPress directory is more than likely not owned by the same user/group that runs apache. If it is owned by the same user you should change immediately because this is a security issue. If you are not as worried about security then you can modify the uploads directory and any sub directories within the uploads directory to allow the apache user to be able to write files and directories within this directory structure. Run either of the commands from the wp-content folder.
chmod: Change Modification- chmod -R 777 uploads
chown: Change Ownership
- chown wpuser.apacheuser -R uploads
The above command needs the proper users to replace wpuser and apacheuser. Issuing the above two commands should allow apache to write the files as necessary for the WordPress admin browser upload to function properly.
- PHP Safe Mode: I have read that the same error can be caused by PHP’s safe_mode being set to on. Make sure that in your php.ini file (usually located in the /etc/ directory) safe_mode is set to off as shown below.
- safe_mode = Off
You will need to restart apache after modifying this setting.
I was facing same image can not be moved after uploading, didn’t reached to a good solution but in my opinion changing permissions to 777 is also not quite good as it brings in security hole providing access to your files to each user.
—
http://www.infopakistan.pk
Hello khurram,
I agree it is not great solution but I am not sure what the work around is in terms of uploads in this scenario. Did you come up with another more secure solution though? I would love to hear an alternative and would be happy to update the article if there is another solution. Thanks for the feedback and hopefully this will spark some discussion on the topic.
THANK YOU SOO MUCH!!! IT works fine now…
:)))))))))
Hello kiyok3wstiyo,
No problem. Glad the article helped out. Thanks for taking the time to leave feedback.
Thanks.
alex
Hello,
I am facing the same problem that an error “The uploaded file could not be moved to xxx” comes up when i try to upload, i have windows server.
so please explain me how can i set file permission to “Upload” folder in wp-config
Please reply ASAP, if you have some solution on this
Hello supraint,
On Windows you will need to right click the folder and select properties to modify the permissions. The exact steps will change a bit depending on the version of Windows. Personally I use cygwin on Windows which provides the Linux level applications such as chmod to still function in the same manner.
Thanks.
alex
Hi,
I appreciate the suggestions to help with this problem, but I am still having difficulty. I don’t know where on wordpress or cPanel to change the ownership setting, and I don’t know where to find the safe mode setting either. Can you advise?
Thanks,
DJ
Hello DJ,
You will need to contact your webhost to help with these settings. More than likely you will have to modify safe mode settings via a .htaccess file or via the host itself. As for the file permission settings you will likely be able to modify these settings via a file manager of some sort. Regardless your webhost can answer these questions for you.
Thanks.
alex
Problem: When trying to upload a plugin to WordPress, the following error is given:
The uploaded file could not be moved to /home/user/public_html/domain.com/wp-content/uploads/2010/12.
Solution: Within WHM, under Main >> Service Configuration >> PHP Configuration Editor, the “upload_max_filesize” was incorrectly set to 64MB, when it should have been set to 64M.
Notice the extra B in MB? It causes the error. Just an FYI…
Hello Jarod,
Thanks for providing this information. This would apply only to virtual hosts set up through cPanel that have an incorrect setting for upload_max_filesize and not to most scenarios. I am sure someone with cPanel though will run across this issue and find the above resolution helpful so posting the details is absolutely appreciated.
Thanks.
alex
NP Alex. I posted this because I ran into this exact same issue. I had a hosting provider upgrade my account from a VPS to a Dediated server, and things never worked right after-wards. They could never find a solution. In the end, this is what I found, fixed, and it made everything work great again.
Hello Jarod,
Sounds good. Thanks again.
Thanks.
alex