Hey there, WordPress user! If you‘re reading this, I‘m guessing you‘re struggling with the "Upload failed to write file to disk" error. Maybe you‘re trying to add an image to a blog post, or upload a new plugin, but you keep getting an error message like this:
Unable to create directory /var/www/html/wp-content/uploads/2023/06. Is its parent directory writable by the server?First of all, don‘t panic! This is a super common WordPress error. In fact, a survey by hosting company Kinsta found that over 25% of WordPress users have encountered an upload issue at some point. So you‘re definitely not alone.
The good news is, the "upload failed" error is almost always fixable with a bit of troubleshooting. As a WordPress developer, I‘ve helped clients resolve this issue countless times. In this guide, I‘ll walk you through the most common causes and the exact steps to get your media uploads working smoothly again.
What Causes the "Upload Failed to Write File to Disk" Error?
Before we jump into solutions, it helps to understand what might be causing your upload failures. The error message can be a bit cryptic, but usually it boils down to one of these issues:
- Incorrect file/folder permissions – WordPress can‘t write to your uploads directory because of overly restrictive permissions.
- Low disk space – Your hosting account has run out of storage space for new uploads.
- Buggy plugins or themes – A poorly coded extension is breaking WordPress‘ default upload functionality.
- Hitting server limits – PHP memory limits, max file size, or other server settings are preventing uploads.
- Corrupt WordPress files – A failed update or botched file transfer has broken part of WordPress core.
Don‘t worry if none of that made sense yet! I‘ll explain each potential cause in more detail as we go through the troubleshooting process step-by-step.
Step 1: Check and Fix File/Folder Permissions
In my experience, incorrect file permissions are the culprit behind the "upload failed" error about 70% of the time. If your /wp-content/ folder or subdirectories have the wrong ownership or access settings, WordPress won‘t be able to write new files there.
To check this, you‘ll need to connect to your site via FTP/SFTP and take a look at your folder permissions. Here‘s how:
- Open your favorite FTP client (I like FileZilla) and log in to your WordPress site.
- Navigate to your WordPress root folder and find the /wp-content/ directory.
- Right-click /wp-content/ and choose "File Permissions".
- In the numeric value field, enter 755. This gives WordPress enough access to write new files.
- Make sure "Recurse into subdirectories" is checked, then choose "Apply to directories only". Click OK.
- Now repeat the process, but this time enter 644 as the numeric value and choose "Apply to files only".
Here‘s a quick cheat sheet for the ideal WordPress folder and file permissions:
| Directory | Permissions |
|---|---|
| /wp-content/ and subdirectories | 755 |
| Individual files | 644 |
| /wp-content/uploads/ | 755 |
| .htaccess | 644 |
| wp-config.php | 440 or 400 |
After adjusting your file permissions, try uploading a file in the WordPress admin again. If it works, great! You‘ve squashed the "upload failed" bug. If not, keep reading.
Step 2: Check Your Hosting Disk Space
Okay, so your file permissions looked okay, but you‘re still getting the "upload failed" error. The next most common cause is simply running out of disk space on your hosting account.
If your hosting plan has limited storage (common on cheap shared hosting), and your WordPress site has been growing steadily, you may have hit your account‘s storage limit without realizing it. When that happens, your host will start denying further uploads.
You can typically check your available disk space in your hosting account dashboard or cPanel. Look for a pie chart or meter showing your storage usage. Here‘s an example from Bluehost:

If you‘re using over 80-90% of your available storage, that could very likely be the reason for your upload failures. It‘s time to either upgrade your hosting plan or do some housekeeping to free up space.
A few ways to quickly reclaim disk space:
- Delete old backups, logs, and unused files in your hosting account
- Install a WordPress plugin like Media Cleaner to find and remove unused images/media
- Offload large files like videos to a separate storage service like Amazon S3
- Upgrade to a hosting plan with more generous storage limits
After freeing up some space, go back to your WordPress dashboard and try uploading again. With any luck, it should work now! But if not, don‘t worry, we still have a few more tricks up our sleeve.
Step 3: Test for Plugin or Theme Conflicts
So you‘ve verified permissions, you‘ve got plenty of disk space, but the "upload failed" error persists. Grrr. The next most likely culprit is a buggy plugin or theme conflicting with WordPress‘ built-in upload functionality.
I‘ve seen this happen with a bunch of different plugins, from image compression tools to security plugins to caching solutions. Often the conflict is unintentional – the developer didn‘t realize their code was breaking uploads. But intentional or not, a plugin conflict can definitely cause the "upload failed" error.
To test this, you‘ll need to systematically deactivate your plugins and switch to a default theme, then check if the error clears. Here‘s how:
- Log in to your WordPress dashboard and go to Plugins > Installed Plugins.
- Select all your plugins, then choose "Deactivate" from the Bulk Actions dropdown. Click "Apply".
- After all plugins are deactivated, go to Appearance > Themes and activate a default theme like Twenty Twenty-Three.
- Now try uploading a file again via Posts > Add New or Media > Add New. If it works, you know a plugin or your theme was the problem!
- Re-activate your theme and plugins one-by-one, testing an upload each time. When the upload fails again, you‘ve found the culprit!
If you do identify a problematic plugin or theme, you can reach out to the developer for help, or switch to an alternative. For must-have plugins, sometimes you can find a patch or workaround with a bit of Googling or posting in support forums.
Step 4: Increase Your Site‘s PHP Memory Limit
Okay, let‘s say you‘ve ruled out permissions, disk space, and plugin conflicts, but you‘re still pulling your hair out over the "upload failed" error. What gives? Another possibility is that you‘re hitting your server‘s PHP memory limit.
By default, WordPress tries to allocate 32MB of memory to PHP processes like uploads. For most sites this is plenty. But if you‘re uploading really large files, or you have a ton of plugins that are hogging memory, 32MB may not be enough. When PHP runs out of memory, you can see errors like "upload failed" or even the dreaded "white screen of death".
You can often fix this by increasing your site‘s PHP memory limit in the /wp-config.php/ file. Here‘s how:
Connect to your WordPress site via FTP and download the /wp-config.php/ file.
Open it in a text editor and look for this line:
define( ‘WP_MEMORY_LIMIT‘, ‘32M‘ );If the line exists, change the value to something higher like 128M or 256M. If it doesn‘t exist, add it yourself near the top of the file:
define( ‘WP_MEMORY_LIMIT‘, ‘256M‘ );Save the file and re-upload it to your server, overwriting the old version.
After increasing the memory limit, try uploading a file in WordPress again. If it works, you‘ve found the solution! If editing /wp-config.php/ doesn‘t work, or you don‘t see any change, you may need to ask your host to increase the memory limit in your server‘s /php.ini/ file instead.
Step 5: Restore a Backup or Reinstall WordPress
If you‘re reading this step, I‘m guessing you‘re still seeing the "upload failed" error even after multiple troubleshooting attempts. First of all, that sucks and I‘m sorry! This error can be a real pain, especially with all the potential causes.
At this point, it‘s likely that something is fundamentally broken with your WordPress files or database. It could be a botched update, a hacking attempt, or file corruption from a bad FTP transfer. In any case, your best bet is to restore a known-good backup of your site, or reinstall WordPress core if you don‘t have a backup.
To restore from a backup:
- Locate your most recent full backup, ideally from before the uploads stopped working.
- Uncompress the backup folder and locate the files for your WordPress core, plugins, themes, uploads, and database (SQL).
- Connect to your site via FTP and rename the existing /wp-content/ folder to something like /wp-content-old/.
- Upload the /wp-content/ folder from your backup.
- Log in to your hosting dashboard and locate your database management tool (usually phpMyAdmin).
- Select your WordPress database, then click "Import" and choose your backup .sql file.
- After importing, delete the /wp-content-old/ via FTP to free up space.
To reinstall WordPress core:
- Download a fresh copy of WordPress from wordpress.org.
- Unzip the files and delete the /wp-content/ folder.
- Connect to your site via FTP and delete the /wp-admin/ and /wp-includes/ folders. Do NOT delete /wp-content/.
- Upload the new /wp-admin/ and /wp-includes/ folders from your fresh WordPress download.
- Log in to your wp-admin and update your themes and plugins to the latest versions.
Restoring from backup or reinstalling core can be a bit technical, so don‘t hesitate to ask your host for help or hire a WordPress pro if you‘re not comfortable doing it yourself. But in either case, it should get your uploads working again by replacing any corrupt core files!
Bonus Tips for Stress-Free WordPress Uploads
Phew, you made it to the end! By now, your "upload failed" error should be a distant memory. Before I wrap up, here are a few tips to keep your WordPress uploads running smoothly and avoid future errors:
- Install a backup plugin and schedule regular backups. I‘m a fan of UpdraftPlus or VaultPress. Regular backups are a lifesaver when upload errors or other issues crop up!
- Optimize images locally before uploading with a tool like ImageOptim or TinyPNG. Smaller image files put less strain on your server resources.
- Consider using a content delivery network (CDN) like Cloudflare or Jetpack to offload media hosting. This reduces load on your hosting server and can improve upload reliability.
- Delete unused plugins and themes to minimize the chance of code conflicts. I always say the best plugin is one you don‘t need to install!
- When in doubt, ask for help in the official WordPress support forums or hire a professional developer. The WordPress community is super friendly and there‘s no shame in getting expert assistance.
I hope this in-depth troubleshooting guide has helped you conquer the dreaded "upload failed to write file to disk" error once and for all. It can be a tricky one to solve, but with a little persistence (and maybe a few cups of coffee), you‘ve got this!
If this guide saved you some headaches, I‘d love to hear about it. Feel free to leave a comment or shoot me an email with your success story. And if you know any other WordPress users pulling their hair out over upload errors, please share this article with them! Because everyone deserves stress-free uploads.
Happy WordPressing!
