WordPress Media Library Upload Errors
This guide helps you identify and fix common upload errors in the WordPress Media Library caused by PHP configuration limits.
Common Error Messages
When uploading files (especially large images or videos) to WordPress, you may see one of these errors:
- “Unexpected response from the server” – usually means the server ran out of time or memory while processing your upload.
- “The uploaded file exceeds the upload_max_filesize directive in php.ini” – your file is larger than the server allows.
- “The uploaded file exceeds the MAX_FILE_SIZE directive” – same issue, triggered by the HTML form limit.
- Upload bar freezes or the page times out – the server’s execution time ran out before the upload completed.
- File appears to upload successfully but doesn’t appear in Media Library – a less obvious failure, often related to memory limits.
Why This Happens
Every web server has PHP settings that control how uploads are handled. When a file exceeds any of these limits, the upload fails. The four settings most commonly responsible are:
| Setting | What It Controls | Typical Default |
upload_max_filesize | Maximum size of a single uploaded file | 2M – 64M |
post_max_size | Maximum size of all data sent in one request (must be larger than upload_max_filesize) | 8M – 128M |
max_execution_time | How many seconds the server will wait before stopping the script | 30 – 300 |
memory_limit | How much RAM PHP can use to process the request | 128M – 256M |
Important:post_max_size must always be equal to or greater than upload_max_filesize. If it’s smaller, uploads will silently fail.
How to Check Your Current Settings
Option 1: WordPress Site Health
- Log in to your WordPress admin dashboard.
- Go to Tools → Site Health → Info.
- Expand the Server section.
- Look for
upload_max_filesize,post_max_size,max_execution_time, andmemory_limit.
Option 2: cPanel
- Log in to cPanel.
- Search for MultiPHP INI Editor OR PHP Selector >> Options
- Review and adjust the values as needed.
Option 3: Plesk
- Log in to Plesk.
- Go to Domains → [your domain] → PHP Settings.
- The relevant limits are listed under “Performance Settings” or in the custom directives area.
Common Causes and Solutions
File size too large
Symptom: Error appears immediately after clicking Upload.
Fix:
- Compress the file before uploading. For images, use tools like TinyPNG or ShortPixel. For videos, use HandBrake or a similar compressor.
- If the file genuinely needs to be that size, increase
upload_max_filesizeandpost_max_size(see below).
PHP timeout
Symptom: Upload bar progresses slowly then the page times out or shows a server error.
Fix:
- Increase
max_execution_timeto 300 (5 minutes) or higher for large files. - Upload during off-peak hours when server load is lower.
- Use a chunked upload plugin (see Best Practices below).
Memory limit exhausted
Symptom: Error appears during upload processing, or file doesn’t appear after upload.
Fix:
- Increase
memory_limitto at least 256M. - If uploading very large images, WordPress may run out of memory generating thumbnails.
How to Increase Limits for Testing
If you have access to cPanel or Plesk, you can increase limits to confirm the issue:
Via cPanel (MultiPHP INI Editor)
- Open MultiPHP INI Editor OR PHP Selector >> Options →
- Set:
upload_max_filesize= 128Mpost_max_size= 128Mmax_execution_time= 300memory_limit= 256M
- Save and retry the upload.
Via Plesk (PHP Settings)
- Go to PHP Settings for your domain.
- Adjust the same four values.
- Click OK/Apply and retry.
Via .htaccess (Apache only)
Add these lines to the .htaccess file in your WordPress root:
php_value upload_max_filesize 128M php_value post_max_size 128M php_value max_execution_time 300 php_value memory_limit 256M
Note: This only works on Apache servers with mod_php. If you’re on LiteSpeed, Nginx, or PHP-FPM, use the control panel method instead.
Via wp-config.php (memory_limit only)
Add this line before “That’s all, stop editing!”:
define('WP_MEMORY_LIMIT', '256M');
This only affects WordPress’s memory limit, not the other PHP settings.
When to Request Limit Increases
Contact support to request changes when:
- You’ve confirmed the error and upload will work with higher limits.
- You don’t have access to change PHP settings yourself.
When contacting support, include:
- Your domain name
- The file size you need to upload
- The current limits (from Site Health)
- What you’ve already tried
Best Practices for Large File Uploads
- Compress files before uploading. Resize images to the maximum display size (usually 1920px wide). Compress videos to H.264/MP4.
- Use a chunked upload plugin. Plugins like “Big File Uploads” or “WP Add Mime Types” split large files into smaller pieces, avoiding timeout issues.
- Consider external hosting for video. YouTube, Vimeo, or Bunny.net are better suited for video delivery than WordPress Media Library.
- Upload via FTP/SFTP for very large files. Upload directly to
/wp-content/uploads/then use a plugin like “Add From Server” or “Media from FTP” to register them in WordPress. - Keep WordPress and plugins updated. Some upload bugs are fixed in newer versions.
When to Escalate
- The file uploaded successfully (confirmed in
/wp-content/uploads/) but WordPress still shows an error. - Increasing all PHP limits doesn’t resolve the issue.
- The error only happens with specific file types.
- Server error logs show 500 errors or mod_security blocks during upload.
Quick Reference Checklist
- ✅ Check the error message to identify the likely cause.
- ✅ Verify current PHP settings via Site Health or control panel.
- ✅ Compare file size against
upload_max_filesizeandpost_max_size. - ✅ Try compressing the file first.
- ✅ Increase limits to confirm the fix.
- ✅ Escalate if the issue persists after all settings are correct.