Type something to search...
How to fix image upload issues in WordPress?

How to fix image upload issues in WordPress?

Most WordPress image upload issues come from a handful of causes: the file is larger than your server allows, the uploads folder has the wrong permissions, the server runs out of memory while processing the image, the file type isn't allowed, or a plugin is interfering. To fix them, you identify the exact error message, then adjust the relevant setting, whether that's PHP upload limits, folder permissions, memory, or the image library WordPress uses.

Few things are more frustrating than dragging an image into the editor and getting a vague "HTTP error" in return. This article walks you through the most common image upload errors, what causes each one, and step-by-step fixes, from simple checks in the dashboard to changes in php.ini, .htaccess, and wp-config.php.

Before You Start: Quick Checks

Many upload problems disappear with a few simple steps. Try these first:

  1. Refresh and retry: Sometimes a temporary glitch or expired session causes a failed upload. Reload the page and try again.
  2. Try a different browser: Browser extensions or cached scripts can interfere with the uploader.
  3. Log out and back in: An expired login cookie can cause uploads to fail silently.
  4. Rename the file: Remove spaces, apostrophes, and special characters from the file name, for example summer-trip.jpg instead of Summer Trip (final)'s.jpg.
  5. Try a smaller image: If a small image uploads fine but a large one fails, you're likely hitting a size or memory limit.
  6. Check Site Health: Go to Tools > Site Health and look for warnings. The Info tab also shows your server's upload limits and image library under Media Handling and Server.

Before making any server-level changes, take a full backup of your site so you can roll back if something goes wrong.

Fix 1: The Generic HTTP Error

The "HTTP error" message is WordPress's way of saying the upload failed without a clear reason. The most common causes are memory limits, image processing problems, and security rules.

Increase the PHP Memory Limit

Processing images, especially large photos, requires memory. If PHP runs out partway through, the upload fails. Increase the WordPress memory limit by adding this line to wp-config.php, above the line that says /* That's all, stop editing! Happy publishing. */:

define( 'WP_MEMORY_LIMIT', '256M' );
define( 'WP_MAX_MEMORY_LIMIT', '512M' );

WP_MAX_MEMORY_LIMIT applies to admin tasks such as image processing. Note that WordPress can't exceed the limit set by your server, so if your host caps PHP memory lower than this, you'll need to raise it in the hosting control panel or ask your host.

Switch the Image Editor From Imagick to GD

WordPress uses either Imagick or GD to process images. On some servers, Imagick struggles with large files or has limited resources, which causes HTTP errors. You can tell WordPress to prefer GD with this snippet in your child theme's functions.php or a small custom plugin:

/**
 * Prefer the GD image editor over Imagick.
 */
function sajjad_prefer_gd_image_editor( $editors ) {
    $gd_editor = 'WP_Image_Editor_GD';

    $editors = array_diff( $editors, array( $gd_editor ) );
    array_unshift( $editors, $gd_editor );

    return $editors;
}
add_filter( 'wp_image_editors', 'sajjad_prefer_gd_image_editor' );

Try uploading again. If it works, Imagick was the culprit. You can keep this in place or ask your host to look into the Imagick configuration.

Limit Imagick Threads

Alternatively, on Apache servers, limiting Imagick to a single thread can fix HTTP errors on shared hosting. Add this line to the top of your .htaccess file:

SetEnv MAGICK_THREAD_LIMIT 1

Not every host honors this setting, but it's a quick, harmless thing to try.

Check Security Plugins and Firewalls

Security plugins, web application firewalls, and server rules such as ModSecurity can block upload requests they consider suspicious. Temporarily disable your security plugin and try again. If the upload works, look for a setting or whitelist rule for async-upload.php or media uploads, or contact your host about ModSecurity rules.

Fix 2: The Uploaded File Exceeds the Maximum Upload Size

If you see a message like "The uploaded file exceeds the upload_max_filesize directive in php.ini" or "exceeds the maximum upload size for this site," your server limits how large a single upload can be.

You can see the current limit in Media > Add New Media File, where WordPress shows "Maximum upload file size."

Option A: Use Your Hosting Control Panel

Many hosts let you change PHP settings from their dashboard. Look for a section called "PHP Settings," "MultiPHP INI Editor" (cPanel), or "PHP Configuration" and raise upload_max_filesize and post_max_size.

Option B: Edit php.ini or .user.ini

If you have access to a php.ini or .user.ini file in your site's root directory, add or update:

upload_max_filesize = 64M
post_max_size = 64M
memory_limit = 256M
max_execution_time = 300

post_max_size should be equal to or larger than upload_max_filesize. Changes to .user.ini can take a few minutes to take effect because PHP caches them.

Option C: Edit .htaccess (Apache With mod_php Only)

On some Apache servers running PHP as a module, you can set limits in .htaccess:

php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value memory_limit 256M
php_value max_execution_time 300

If your site shows a 500 Internal Server Error after adding these lines, your server runs PHP differently (for example, PHP-FPM). Remove the lines and use Option A or B instead.

Option D: Nginx Servers

On Nginx, the web server has its own request size limit. If you see a "413 Request Entity Too Large" error, increase client_max_body_size in your server block:

server {
    # ...
    client_max_body_size 64M;
}

Reload Nginx afterward. You'll still need to raise the PHP limits as well.

Of course, the best long-term fix for oversized images is to resize them before uploading. There's rarely a reason to upload a 20 MB photo to a website.

Fix 3: Sorry, You Are Not Allowed to Upload This File Type

WordPress only allows certain file types for security reasons. If you try to upload an unsupported format, you'll see "Sorry, you are not allowed to upload this file type."

Common reasons include:

  • The file is an SVG: SVG is blocked by default because it can contain scripts.
  • The file is HEIC: iPhone photos are often HEIC. Convert them to JPEG or WebP before uploading, or change your phone's camera setting to save in a more compatible format. Recent WordPress versions can handle HEIC uploads on servers whose Imagick supports it, but support varies.
  • The file extension doesn't match its contents: A PNG renamed to .jpg, for example, can fail WordPress's file type check.
  • Your user role lacks permission: Only users with the upload_files capability (Authors and above by default) can upload media.

Allowing Additional File Types Safely

If you genuinely need a file type WordPress doesn't allow, you can add it with the upload_mimes filter. Only do this for formats you trust, and restrict it to administrators when possible:

/**
 * Allow administrators to upload additional file types.
 */
function sajjad_allow_extra_mimes( $mimes ) {
    if ( current_user_can( 'manage_options' ) ) {
        $mimes['ico'] = 'image/x-icon';
    }

    return $mimes;
}
add_filter( 'upload_mimes', 'sajjad_allow_extra_mimes' );

For SVG files, use a plugin that sanitizes them, such as Safe SVG, rather than simply adding the MIME type. Unsanitized SVGs are a security risk.

Avoid defining ALLOW_UNFILTERED_UPLOADS in wp-config.php as a quick fix. It lets administrators upload any file type without checks, which opens the door to serious security problems.

Fix 4: Unable to Create Directory or Missing Permissions

Messages like "Unable to create directory wp-content/uploads/2026/09. Is its parent directory writable by the server?" mean WordPress can't write to the uploads folder.

Check Folder Permissions

Connect to your site with FTP/SFTP or your host's file manager and check the permissions of wp-content/uploads:

  • Folders should typically be 755.
  • Files should typically be 644.

Avoid setting folders to 777. It may seem to fix the problem, but it makes your files writable by anyone on the server.

If you have SSH access, you can reset permissions with:

# Run from your WordPress root directory
find wp-content/uploads -type d -exec chmod 755 {} \;
find wp-content/uploads -type f -exec chmod 644 {} \;

Check File Ownership

Correct permissions don't help if the folder is owned by the wrong user. The files must be owned by the user your web server or PHP process runs as. On many managed hosts, you can use a "Fix permissions" tool in the control panel. On a VPS, you might run something like the following, replacing www-data with your server's actual user:

sudo chown -R www-data:www-data wp-content/uploads

If you're not sure which user to use, ask your host before changing ownership.

Check the Upload Path Setting

Older sites sometimes have a custom upload path stored in the database. If your site was migrated, that path may point to a folder that no longer exists. Check with WP-CLI:

wp option get upload_path

If it returns an outdated absolute path, reset it so WordPress uses the default wp-content/uploads:

wp option update upload_path ''

If you don't use WP-CLI, look for an Uploading Files section under Settings > Media. WordPress only displays that field when a custom path has been set.

Check Disk Space

If your hosting account has run out of disk space, uploads will fail. Check your usage in your hosting control panel and clean up old backups, logs, or unused files if needed.

Fix 5: Image Uploads but Thumbnails Are Missing or Broken

Sometimes the upload succeeds, but the image shows as a gray box in the Media Library or thumbnails are missing.

  1. Check for processing errors: The server may have run out of memory while creating sub-sizes. Increase memory as described above.
  2. Regenerate thumbnails: Use the Regenerate Thumbnails plugin or WP-CLI (wp media regenerate) to recreate missing sizes.
  3. Check for a CDN or offload plugin: If you use a plugin that moves images to external storage, verify its connection settings and credentials.
  4. Look for hotlink protection: Overly strict hotlink protection at the host or CDN can block your own admin from loading images.
  5. Check for mixed content: If your site uses HTTPS but image URLs are saved as http://, browsers may block them. Confirm both URLs under Settings > General use https://.

Fix 6: Image Uploads Fail in the Block Editor Only

If uploads work under Media > Add New Media File but fail when you drop an image into a block, the issue is often the REST API or a JavaScript conflict.

  1. Check the browser console: Open developer tools and look for errors when the upload fails.
  2. Test the REST API: Go to Tools > Site Health and look for REST API warnings.
  3. Disable plugins one at a time: A security or optimization plugin may be blocking REST requests.
  4. Switch to a default theme temporarily: This rules out theme conflicts.

Fix 7: Rule Out Plugin and Theme Conflicts

If none of the specific fixes work, isolate the cause:

  1. Deactivate all plugins from Plugins > Installed Plugins, then try uploading.
  2. Reactivate plugins one by one, testing after each, until the problem returns.
  3. Switch to a default theme such as Twenty Twenty-Five and test again.

The free Health Check & Troubleshooting plugin lets you do this in a troubleshooting mode that only affects your own session, so visitors don't see a broken site while you test.

Fix 8: Enable Debugging to Find the Real Error

When the error message is unhelpful, WordPress's debug log can reveal the actual problem. Add the following to wp-config.php above the "That's all, stop editing!" line:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );

Try the upload again, then check wp-content/debug.log for errors related to memory, image processing, or plugins. Turn debugging off again when you're done, since leaving the log active on a live site isn't a good idea.

Your hosting control panel may also offer a PHP error log, which can show server-level issues that WordPress doesn't catch.

How to Prevent Image Upload Problems

A few habits reduce the chances of running into upload issues:

  • Resize images before uploading: Keep images to a reasonable size, typically under a few megabytes.
  • Use supported formats: Stick to JPEG, PNG, WebP, GIF, and AVIF where supported.
  • Use clean file names: Lowercase letters, numbers, and hyphens only.
  • Keep WordPress, themes, and plugins updated: Updates often fix media-related bugs.
  • Monitor disk space: Clean up old backups and unused media regularly.
  • Run a modern PHP version: PHP 8.x with current image libraries handles uploads more reliably.

FAQ: Fixing Image Upload Issues in WordPress

The HTTP error is usually caused by insufficient PHP memory, problems with the Imagick image library, or a security rule blocking the upload. Increasing memory, switching to the GD editor, or temporarily disabling security plugins usually fixes it.

Raise upload_max_filesize and post_max_size in your hosting control panel, php.ini, or .user.ini. On Apache with mod_php you can also use .htaccess, and on Nginx you may need to raise client_max_body_size.

Folders should usually be set to 755 and files to 644, and they must be owned by the user your web server runs as. Avoid 777 permissions because they're a security risk.

WordPress blocks SVG uploads by default because SVG files can contain malicious scripts. Use a plugin that sanitizes SVGs, such as Safe SVG, if you need them.

This usually means thumbnails failed to generate, often due to memory limits. Increase PHP memory and regenerate thumbnails, and check for CDN, offload, or HTTPS issues.

Yes. Security, optimization, and media plugins can block or interfere with uploads. Deactivate plugins one at a time, or use the Health Check and Troubleshooting plugin, to find the culprit.

Only roles with the upload_files capability can upload media. By default, Contributors and Subscribers can't upload files, while Authors, Editors, and Administrators can.


Conclusion

Image upload issues in WordPress can look mysterious, but they almost always trace back to a small set of causes: size limits, memory, permissions, file types, the image library, or a plugin conflict. Start with the exact error message, work through the matching fix, and use debugging tools when the message isn't clear enough.

Once uploads are working again, build in a few preventive habits, like resizing images before uploading, keeping file names clean, and staying on a modern PHP version. That way, adding images to your content stays quick and painless, and you can spend your time creating rather than troubleshooting.

Tags :
Share :

Related Posts

What are the best WordPress security plugins?

What are the best WordPress security plugins?

The best WordPress security plugins for most sites are Wordfence, Sucuri Security, Solid Security, MalCare, All-In-One Security (AIOS), Patchstack, a

Dive Deeper
What is the difference between posts and pages in WordPress?

What is the difference between posts and pages in WordPress?

The main difference between posts and pages in WordPress is that posts are timely, dated entries that appear in your blog feed, archives, and RSS fee

Dive Deeper
How much does it cost to build a WordPress website?

How much does it cost to build a WordPress website?

Building a WordPress website can cost anywhere from roughly the price of a domain and a year of budget hosting, if you do it yourself with free tools

Dive Deeper