What failed to write file to disk means
PHP identifies this condition as UPLOAD_ERR_CANT_WRITE, upload error code 7. In practical terms, the upload reached PHP but the server could not write the file to disk.
WordPress uploads normally pass through PHP's temporary upload handling before being moved into the site's media storage under wp-content/uploads. A failure can therefore happen before WordPress writes the final media file, or because WordPress cannot write to the destination afterwards.
This distinction matters. Changing WordPress settings will not repair a full server disk or an unwritable PHP temporary directory. Conversely, changing PHP limits will not fix incorrect ownership on wp-content/uploads. The safest approach is to identify which location cannot be written to before changing permissions.
Common causes of failed WordPress uploads
Incorrect filesystem ownership or permissions are common after a site migration, manual restore or hosting account change. The files may belong to one system user while PHP runs as another, leaving WordPress unable to create new files or directories.
A server or hosting account can also be out of storage space or inode capacity. In that situation, uploads may fail even though the website itself still loads normally. Temporary storage is another possibility. PHP can be configured with an upload_tmp_dir, and problems with that directory can interrupt an upload before WordPress gets the file.
Less commonly, restrictive server security settings, a read only filesystem or a hosting fault can block writes. If uploads stopped suddenly without a WordPress change, checking server storage and recent hosting changes is usually more useful than reinstalling plugins.
How to fix failed to write file to disk
- Take a full backup of the website files and database before editing configuration, permissions or server files.
- Check your hosting storage usage first. Remove only files you recognise and no longer need, or increase the available storage. Do not delete WordPress core files, wp-config.php or unfamiliar server files to make space.
- Confirm whether WordPress can create files in wp-content/uploads. If existing media loads but every new upload fails, inspect that directory's ownership and permissions through your hosting panel, SFTP or your host's support tools.
- Use the permissions recommended for your actual hosting configuration. WordPress documents 755 directories and 644 files as common values in many setups, but server ownership and PHP execution model matter. Do not set the uploads directory to 777 as a general fix.
- Ask the host to check PHP's temporary upload directory if the destination permissions are correct. The PHP setting involved may be upload_tmp_dir, and the PHP process needs permission to write there.
- Check the PHP and web server error logs at the time of a failed upload. Disk full, permission denied, read only filesystem and temporary directory errors normally provide a clearer diagnosis than the WordPress message.
If you edit php.ini or another server configuration file, change only the setting you have identified as faulty and keep a copy of the original configuration so it can be restored.
When to get help with WordPress upload failures
Stop changing permissions if the correct owner is unclear, if multiple sites on the same account are affected, or if the hosting filesystem reports read only behaviour. Those cases can require server administration rather than a WordPress change.
You should also investigate further if writable files or directories unexpectedly change ownership. Repeatedly applying broader permissions can conceal the original configuration problem and weaken the site's security.
Web Support Services offers an Emergency Fix for £249 per incident with a response within 2 working hours. Care plans start from £59 a month for ongoing website maintenance and support.