Have a Question?

If you have any question you can ask below or enter what you are looking for!

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

  1. Log in to your WordPress admin dashboard.
  2. Go to Tools → Site Health → Info.
  3. Expand the Server section.
  4. Look for upload_max_filesize, post_max_size, max_execution_time, and memory_limit.

Option 2: cPanel

  1. Log in to cPanel.
  2. Search for MultiPHP INI Editor OR PHP Selector >> Options
  3. Review and adjust the values as needed.

Option 3: Plesk

  1. Log in to Plesk.
  2. Go to Domains → [your domain] → PHP Settings.
  3. 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_filesize and post_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_time to 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_limit to 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)

  1. Open MultiPHP INI Editor OR PHP Selector >> Options →
  2. Set:
    • upload_max_filesize = 128M
    • post_max_size = 128M
    • max_execution_time = 300
    • memory_limit = 256M
  3. Save and retry the upload.

Via Plesk (PHP Settings)

  1. Go to PHP Settings for your domain.
  2. Adjust the same four values.
  3. 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

  1. Compress files before uploading. Resize images to the maximum display size (usually 1920px wide). Compress videos to H.264/MP4.
  2. Use a chunked upload plugin. Plugins like “Big File Uploads” or “WP Add Mime Types” split large files into smaller pieces, avoiding timeout issues.
  3. Consider external hosting for video. YouTube, Vimeo, or Bunny.net are better suited for video delivery than WordPress Media Library.
  4. 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.
  5. 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

  1. ✅ Check the error message to identify the likely cause.
  2. ✅ Verify current PHP settings via Site Health or control panel.
  3. ✅ Compare file size against upload_max_filesize and post_max_size.
  4. ✅ Try compressing the file first.
  5. ✅ Increase limits to confirm the fix.
  6. ✅ Escalate if the issue persists after all settings are correct.

© 2026 Jolt, a Freethought Group company encompassing Jolt, Freethought Internet, and Freethought Services. Jolt is a trading name of Host Lincoln Limited (06111631) registered in England and Wales at Unit 5, Oak House, Witham Park, Waterside South, Lincoln, LN5 7FB. Freethought® and the Freethought face are registered trademarks.
Visa MasterCard American Express PayPal Direct Debit Webmoney