Question

Wordpress: The uploaded file could not be moved to wp-content/uploads/

Hey guys, I’m having an issue with not being able to upload media onto the wordpress site. Plugins update and install normally, but if i try to upload a pic for a post, it gives me the error “The uploaded file could not be moved to wp-content/uploads/2016/03/”. I checked to make sure that www-data has access over my website root folder. I did the same with my FTP user. I even changed wp-content and uploads perms to 777. Nothing works. If you have a solution, it would be appreciated.

Subscribe
Share

Ubuntu doesn’t have SELinux. I’m getting no errors on web server logs.

Try setting SELinux in permissive mode & also check the web server logs for errors.


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

|Solution!| So basically after having a head-ache with permissions and ownership, I came across the final solution. I have a secure ftp user called ‘wp-user’ which I got from the tutorial here a while back. Apparently the fix is very simple, and it’s not a permissions issue.

During the set up process you define FTP Components in wp-config with the following lines:

define('FTP_PUBKEY','/home/wp-user/wp_rsa.pub');
define('FTP_PRIKEY','/home/wp-user/wp_rsa');
define('FTP_USER','wp-user');
define('FTP_PASS','');
define('FTP_HOST','127.0.0.1:22');

All you have to do is move those lines above the line which says:

/* That's all, stop editing! Happy blogging. */

Apparently the media uploader freaks out when the FTP Components are below that line, despite the plugin updater working fine. Hope this helps anyone who had this similar issue.

Apply this command

sudo chown -R www-data <path>/wp-content/uploads

You need to give permission to Php to write in this folder.

Apply this command

sudo chown -R www-data <path>/wp-content/uploads

You need to give permission to Php to write in this folder.

Apply this command

sudo chown -R www-data <path>/wp-content/uploads

You need to give permission to Php to write in this folder.

Apply this command

sudo chown -R www-data <path>/wp-content/uploads

You need to give permission to Php to write in this folder.

Apply this command

sudo chown -R www-data <path>/wp-content/uploads

You need to give permission to Php to write in this folder.

Apply this command

sudo chown -R www-data <path>/wp-content/uploads

You need to give permission to Php to write in this folder.

Apply this command

sudo chown -R www-data <path>/wp-content/uploads

You need to give permission to Php to write in this folder.

Apply this command

sudo chown -R www-data <path>/wp-content/uploads

You need to give permission to Php to write in this folder.

Apply this command

sudo chown -R www-data <path>/wp-content/uploads

You need to give permission to Php to write in this folder.

Apply this command

sudo chown -R www-data <path>/wp-content/uploads

You need to give permission to Php to write in this folder.