0
0
WordpressDebug / FixBeginner · 4 min read

How to Fix Upload Failed Error in WordPress Quickly

The WordPress upload failed error usually happens due to file size limits, incorrect folder permissions, or PHP configuration issues. Fix it by increasing upload_max_filesize and post_max_size in php.ini, setting correct permissions on the wp-content/uploads folder, and ensuring your theme or plugins are not blocking uploads.
🔍

Why This Happens

The upload failed error in WordPress often happens because the server limits the file size you can upload or the folder where files are saved does not have the right permissions. Sometimes, PHP settings like upload_max_filesize and post_max_size are too low, or the wp-content/uploads folder is not writable. This stops WordPress from saving your file.

php
<?php
// Example of PHP config limiting upload size
ini_set('upload_max_filesize', '2M');
ini_set('post_max_size', '2M');
?>
Output
Upload failed: File exceeds the maximum upload size allowed by the server.
🔧

The Fix

To fix this, increase the upload size limits in your php.ini file and set correct permissions on the uploads folder. This lets WordPress accept bigger files and save them properly.

Also, check your theme or plugins to make sure they are not blocking uploads.

bash
; In php.ini file
upload_max_filesize = 64M
post_max_size = 64M

# Set folder permissions via command line
chmod 755 wp-content/uploads
chown www-data:www-data wp-content/uploads
Output
Uploads now succeed without errors.
🛡️

Prevention

To avoid upload errors in the future, always keep your PHP settings updated to handle your expected file sizes. Regularly check folder permissions to ensure WordPress can write files. Use trusted plugins and themes that do not interfere with uploads. Also, monitor your server error logs to catch issues early.

⚠️

Related Errors

  • HTTP Error during upload: Often fixed by increasing PHP memory limit or disabling conflicting plugins.
  • Permission denied error: Fix by setting correct folder ownership and permissions.
  • File type not allowed: Add allowed mime types in functions.php or use a plugin.

Key Takeaways

Increase PHP upload_max_filesize and post_max_size to allow bigger files.
Set correct permissions (755) and ownership on wp-content/uploads folder.
Check plugins and themes for upload restrictions or conflicts.
Monitor server logs to catch upload issues early.
Use trusted plugins to extend allowed file types if needed.