Skip to content

WordPress image upload failures — disk, permission, plugin

Fix WordPress image uploads that fail with a bare "HTTP error" in the media library. Check four things in order, from disk space and folder permissions to plugin filters and PHP limits, then confirm the fix with a WP-CLI import.

If WordPress shows only “HTTP error” when you upload an image to the media library, the real cause is hidden, and checking four things in order will find it. WordPress returns that same message for every upload failure, whether the disk is full, the uploads folder has the wrong owner, or PHP ran out of memory while making thumbnails. Check disk space first, then the ownership and permissions of wp-content/uploads/, then plugins that filter uploads, such as security and image-optimization plugins, and PHP’s memory and time limits last. Your browser’s developer tools often show the actual PHP error in the upload response, and a wp media import run from the server’s command line confirms the fix without the browser in the way.

What’s happening

wp_handle_upload() validates the file, moves it from PHP’s temp upload directory into /wp-content/uploads/YYYY/MM/, then calls wp_generate_attachment_metadata() to create thumbnail sizes. Any of those steps can fail: PHP’s upload_max_filesize rejects the file before WordPress sees it, the temp directory can be unwritable, the destination directory can be unwritable, the image library (GD or Imagick) can choke on the file, or a plugin hooked into wp_handle_upload_prefilter can reject the upload silently.

The four common causes, ordered by frequency: disk full, permission wrong on /wp-content/uploads/, plugin filter rejecting the MIME type, PHP memory or execution-time limit exceeded during thumbnail generation.

How to verify

df -h /home/example/public_html/wp-content/uploads/
stat -c '%U:%G %a' /home/example/public_html/wp-content/uploads/
ls -la /home/example/public_html/wp-content/uploads/$(date +%Y/%m)/ | head
wp eval 'echo wp_max_upload_size() / 1024 / 1024 . " MB" . PHP_EOL;'
wp eval 'echo ini_get("upload_max_filesize") . " / " . ini_get("post_max_size") . " / " . ini_get("memory_limit") . PHP_EOL;'
tail -f /home/example/logs/error_log

In the browser, open DevTools > Network. Attempt the upload. The /wp-admin/async-upload.php response will contain the actual PHP error in 80% of cases — the modal swallows it but the response body has the truth.

The fix

  1. Disk first. If df shows the uploads partition above 95%, no upload will succeed. Move old uploads to object storage or extend the disk before debugging anything else.
  2. Permission second. /wp-content/uploads/ and every year/month subdirectory should be owned by the PHP user (often www-data, nginx, or the cPanel account) with mode 755. chown -R example:example then find ... -type d -exec chmod 755 {} \; fixes most takeover misconfigurations.
  3. Plugin third. Deactivate every plugin that hooks wp_handle_upload_prefilter or upload_mimes — security plugins, file-type restrictors, image optimizers. Re-test. Re-enable one at a time.
  4. PHP limits last. If the file is large or the image is high-resolution, thumbnail generation can exceed memory_limit or max_execution_time. Raise them in wp-config.php: define('WP_MEMORY_LIMIT', '512M'); ini_set('memory_limit', '512M'); and the host’s php.ini for upload_max_filesize, post_max_size, max_execution_time.
  5. Confirm with WP-CLI. wp media import /tmp/test-image.jpg --post_id=1 bypasses the browser and the JavaScript layer. If it succeeds from the CLI but not the browser, the issue is on the browser side — usually a security plugin or the WAF. For sites under Enterprise WordPress management, the upload pipeline is part of standard health checks, not waited-on bug reports.

Stack Harbor’s Enterprise WordPress operating model treats upload reliability as part of the SLA, not an editorial concern. When the team is hitting random upload failures and no one can reproduce them, start the conversation.