Nine times out of ten, the WordPress failed to write file to disk error is a file permissions problem, and the fix takes less than five minutes once you know where to look. The error appears in the media uploader when you try to upload an image, document, or any other file — the upload bar fills, and then instead of a thumbnail you get the message “Unable to create directory” or “Upload: Failed to Write File to Disk.” The WordPress failed to write file to disk error means exactly what it says: WordPress tried to save the uploaded file somewhere on the server and could not. The server received the file, but when WordPress attempted to write it to the uploads directory, something blocked the write operation. Whether that something is incorrect file permissions, a full disk, an incorrect uploads path configuration, or an ownership conflict between PHP and FTP processes determines which fix applies. This guide covers every cause of the WordPress failed to write file to disk error and the specific resolution for each, in the sequence that resolves most cases fastest. We go deeper on the whole subject in our WordPress Errors Complete Guide.
Why the WordPress Failed to Write File to Disk Error Appears
The WordPress file upload process follows a specific sequence: the file is received by the server into a temporary directory, WordPress validates it, and then PHP attempts to move it from the temporary location to the permanent uploads directory at wp-content/uploads/. The WordPress failed to write file to disk error occurs during that final move operation — the temporary file exists and is valid, but the move to the uploads directory fails. The failure can happen because PHP does not have write permission to the target directory, because the target directory does not exist and cannot be created, because the disk is full, or because the uploads directory path in WordPress’s configuration points somewhere that does not exist.
The most common reason for encountering the WordPress failed to write file to disk error on an established site — rather than a new one — is a change in the hosting environment. A server migration, a PHP version upgrade, a hosting plan change, or a change in the web server user can all alter the relationship between the PHP process and the file system in ways that produce the WordPress failed to write file to disk error on a site that was uploading files perfectly well the day before. The configuration that worked previously is no longer compatible with the new environment.
Fresh WordPress installations sometimes show the WordPress failed to write file to disk error from the very first upload attempt. In this case, the issue is almost always one of three things: the uploads directory was not created during installation and WordPress cannot create it, the uploads directory was created but with permissions that prevent PHP from writing to it, or the uploads directory path configured in WordPress does not match where the directory actually exists on the server. All three are straightforward to diagnose and fix once you know what to look for.
Fix File Permissions on the Uploads Directory
File permissions are the cause of the WordPress failed to write file to disk error in the overwhelming majority of cases. The wp-content/uploads/ directory — and all of its year and month subdirectories — must be writable by the PHP process that WordPress runs under. On most shared hosting configurations, this means the directory needs to be set to 755 permissions. A directory at 644 or 444 cannot be written to by any user other than the file owner, and if that owner is not the PHP user, the WordPress failed to write file to disk error results every time.
- Connect to your server via FTP or your hosting control panel’s file manager
- Navigate to
wp-content/uploads/. If the uploads folder does not exist at all, create it manually — right-click in thewp-content/directory and create a new folder nameduploads - Right-click the
uploadsfolder and open its file permissions or attributes settings - Set the numeric permission value to 755 and, critically, enable the option to apply this change recursively to all files and subdirectories within uploads
- Save the permission change
- Return to WordPress and attempt an image upload to test whether the WordPress failed to write file to disk error has cleared
If 755 does not resolve the WordPress failed to write file to disk error, try 775 — which gives the group write access in addition to the owner. Some hosting configurations run the web server and PHP under a common group, and 775 allows both to write. Avoid setting uploads to 777 (world-writable) on a production site — it works, but it introduces a security vulnerability by allowing any process on the server to write to your uploads directory. If the WordPress failed to write file to disk error persists at both 755 and 775, the problem is ownership rather than permissions — which the next section addresses.
Disk Quota and Storage Space Causing the Error
A full disk or an exceeded hosting quota produces the WordPress failed to write file to disk error in a way that is easily confused with a permissions problem. Both cause the write operation to fail; both show the same error message. The distinction is that permissions problems fail consistently and at any file size, while disk-full failures typically fail for all uploads simultaneously and may have appeared suddenly after a period of normal operation. If uploads were working yesterday and are failing today across every file type and size, checking available disk space is worth doing before spending time on permissions.
Log in to cPanel and look at the disk usage meter on the main dashboard. Most shared hosting plans show used and total storage at a glance. If you are at or near the limit, any upload attempt produces the WordPress failed to write file to disk error because there is literally no space to write the new file. Freeing space — deleting old backups, clearing unused plugin files, removing orphaned media from the uploads directory using a plugin like Media Cleaner — resolves the WordPress failed to write file to disk error immediately once sufficient space is available. On VPS servers, the df -h command in terminal shows disk usage per partition.
Some WordPress backup plugins create very large backup files and store them in the uploads directory or a subdirectory. A backup plugin running daily and keeping 30 days of backups can easily consume tens of gigabytes, eventually pushing a shared hosting account to its storage limit and producing the WordPress failed to write file to disk error for all subsequent uploads. Configure backup plugins to store backups remotely — in Google Drive, Amazon S3, Dropbox, or a similar remote storage service — and to keep only the number of backups actually needed for recovery purposes. This prevents backup accumulation from causing the WordPress failed to write file to disk error in the future.
Incorrect Uploads Directory Configuration
WordPress stores the uploads directory path in the database under the option keys upload_path and uploadpath, and these values can occasionally become incorrect — typically after a site migration, a domain change, or a manual configuration change that was applied inconsistently. When these paths do not match the actual server path to the uploads directory, every upload attempt produces the WordPress failed to write file to disk error because WordPress tries to write to a location that either does not exist or is not where the server expects it.
The cleanest way to verify and correct the uploads path configuration is through the WordPress admin at Settings → Media. The “Store uploads in this folder” field should show wp-content/uploads (a relative path) or the correct absolute server path. An absolute path that was correct on the previous server will be wrong on a new server if the directory structure is different. Changing this to the simple relative path wp-content/uploads — which WordPress resolves relative to the WordPress installation — works correctly on any server without hardcoding a path that might change. Save the setting and test an upload to confirm the WordPress failed to write file to disk error has cleared.
The wp-config.php file can also define the uploads directory through the UPLOADS constant. If a previous developer or plugin added define( 'UPLOADS', 'wp-content/uploads' ); or a custom path, verify this matches the actual uploads directory location. A mismatch here overrides the database setting and consistently produces the WordPress failed to write file to disk error regardless of what the Media settings show in the admin panel.
PHP and FTP Ownership Conflicts
On servers where PHP runs as one system user and FTP operates as a different user, files created through FTP (including manually created directories) may be owned by the FTP user rather than the PHP user. When PHP then tries to write new uploaded files into those FTP-owned directories, it is refused — producing the WordPress failed to write file to disk error — even though the directory appears to have the correct 755 permissions. The permissions are set correctly, but for the wrong user.
This ownership conflict is the underlying cause when the WordPress failed to write file to disk error persists despite seemingly correct permissions, and it is more common on VPS and dedicated server environments than on shared hosting. The diagnostic confirmation is straightforward if you have SSH access: run ls -la wp-content/ in your WordPress directory and look at the owner column. If the uploads directory shows a different owner than the one PHP runs under (visible in phpinfo() under PHP_OS_RELEASE or Server API), the ownership mismatch is confirmed.
The fix is changing ownership of the uploads directory to the PHP process user. With SSH access: chown -R www-data:www-data wp-content/uploads/ (replacing www-data with the actual PHP user on your server). On cPanel-based shared hosting where SSH is not available, contact your host’s support team — this is a server-level operation that requires their involvement. Describe the WordPress failed to write file to disk error, confirm you have verified permissions are at 755, and ask whether an FTP/PHP ownership conflict could be the cause. Most hosts can resolve this within a support ticket.
Fixing the WordPress Failed to Write File to Disk Error After a Site Migration
Site migrations are the single most common context in which the WordPress failed to write file to disk error appears on a previously working site. When a WordPress installation moves from one server to another, the file ownership, PHP user, server path structure, and disk quota configuration all potentially change — and any one of them being different from what WordPress expects produces the WordPress failed to write file to disk error on the new server even though the site was functioning perfectly on the old one.
A post-migration checklist for the WordPress failed to write file to disk error: verify uploads directory permissions are 755; verify the uploads directory exists at wp-content/uploads/; check the Media settings upload path is a relative rather than absolute value; confirm the disk quota on the new host has been applied and that the account has sufficient space; verify the PHP user on the new server has write access to the uploads directory and matches the file ownership. Working through these five checks in sequence resolves the WordPress failed to write file to disk error in virtually every post-migration scenario.
Our guide on how to migrate WordPress safely covers the full migration process including the post-migration checks that prevent the WordPress failed to write file to disk error and other migration-related problems from appearing after the move. Our guide on fixing the WordPress image upload HTTP error covers the related upload failure that presents as an HTTP error rather than a write-to-disk error — the two appear in different circumstances but share some of the same underlying causes. The WordPress documentation on file permissions covers the full permission structure for WordPress installations including the specific permission requirements for the uploads directory that prevent the WordPress failed to write file to disk error. You might also run into WordPress Upload Size Limit.






