WordPress Media Library uploads failing? Here's the fix
Images fail to upload in WordPress? It's probably server PHP limits or file permissions. Here's what actually fixes it.
When this shows up
You're sitting in the WordPress admin, click "Add New" under Media, pick a 2MB JPEG, and nothing happens. The upload bar shows maybe 10% then freezes. Or you get an HTTP error — no details, just "An error occurred in the upload. Please try again later."
Had a client last month who thought their whole site was hacked because of this. Turned out it was a simple PHP memory limit. Saw another client whose images uploaded fine on their local dev machine but failed on the live server. Different host, same problem.
Root cause — what's actually happening
WordPress uses PHP to handle uploads. When you upload a file, PHP needs permission to write to the wp-content/uploads folder. It also needs enough memory to process the image — especially if you're uploading raw photos or large JPEGs.
Three things kill this every time:
- PHP memory limit too low — Default is often 32MB or 64MB. WordPress itself needs 40MB just to run. Add an image and it's gone.
- File permissions wrong — The web server user (www-data, nginx, etc.) doesn't have write access to the uploads folder.
- PHP upload limits set too low —
upload_max_filesizeorpost_max_sizecap at 2MB or 8MB.
Rarely it's a plugin conflict — some security plugins block uploads, or an image optimizer plugin runs out of memory trying to resize. But start with the server settings, not plugins. That's where 90% of cases end.
The fix — step by step
I do this in order. Skip around if you're in a hurry, but this sequence catches the most common causes first.
Step 1: Check PHP memory limit
Log into your hosting control panel (cPanel, Plesk, or whatever). Look for "Select PHP Version" or "PHP Settings". Increase memory_limit to 256M. If you can't find that, ask your host. Had a client on a budget shared host who had to call support — took five minutes.
If you have command line access, run:
php -i | grep memory_limit
That shows the current value. If it's 128M or less, bump it up.
Step 2: Upload file size limits
Same PHP settings area, look for upload_max_filesize and post_max_size. Set both to at least 64M. If you're uploading big photos or PDFs, go 128M or 256M.
Rule of thumb: post_max_size must be bigger than upload_max_filesize. I set post_max_size to 256M and upload_max_filesize to 128M. Works across all my client sites.
Step 3: Fix folder permissions
The uploads folder needs to be writable by the web server. SSH into your server or use your host's file manager. Go to wp-content. Run:
chmod -R 755 wp-content/uploads
If that doesn't fix it, try 775 (some hosts need the group write). Never use 777 — that's a security risk.
Step 4: Check .htaccess or nginx config
Some hosts block uploads via mod_security. Try temporarily renaming your .htaccess file in the WordPress root directory. If that fixes it, mod_security was the culprit. You can add an exception:
<IfModule mod_security.c>
SecRuleEngine Off
</IfModule>
Only do this for the uploads folder path, not the whole site.
Step 5: Test without plugins
If steps 1-4 don't work, rename the wp-content/plugins folder to something else (like plugins_deactivated). That disables all plugins. Try uploading again. If it works, reactivate plugins one by one until you find the one breaking things. Common suspects: security plugins (Wordfence, iThemes Security), image optimization (Smush, ShortPixel), and caching plugins.
Still failing? Check these
If none of that worked, look at the server error logs. Most hosts give you access through cPanel or a similar interface. Search for "PHP Fatal error" around the time you tried uploading. That'll show you exactly what's running out of memory or failing.
Also check your wp-config.php for any custom upload path settings. Sometimes clients or previous devs set a custom path that doesn't exist anymore. Look for define('UPLOADS', ...) — comment it out with // at the start of the line to see if that's the issue.
Last resort: ask your host directly. Some shared hosts have hard limits you can't override. Had a client on a $5/month plan who couldn't upload anything over 1MB. Moved to a better host, problem gone.
If you're on a VPS or dedicated server, check the PHP configuration file (php.ini) directly. Location varies, but usually in /etc/php/ or /usr/local/php/. Edit that file, change the values, restart the web server. That's the nuclear option, but it works.
Was this solution helpful?