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 Modificationbash
- chmod -R 777 uploads
chown: Change Ownershipbash
- 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.