Many claims WordPress is the easy to use content management system. Though it works smartly, it will show complicated technical errors that normal users can’t understand. One of the big problems with WordPress is the errors you see while uploading files and images. These file upload errors in WordPress appears during different situation and make you crazy enough to stop the entire the work or workflow. If you are stuck in such a situation, here are some of the expert tips to resolve file upload errors in WordPress and continue your work.
File Uploads in WordPress
There are three different ways you can upload a file in WordPress site. Though using the admin panel is the most easy options, you can also use FTP and File Manager app from hosting panel for uploading large number of files. Here are the three major file uploads all WordPress users need to do as part of running a site.
- Media file upload
- Theme upload
- Plugin upload
Depending upon the action, you may face different types of errors in WordPress. Before we explain the errors and solutions, make sure you upload images only through Media Library or from the post editor in WordPress. Otherwise, the images you upload through FTP will not appear in the Media Library. If you are looking for showing images uploaded through FTP, check out our article which explains the solution in detail. Also note that here we discuss about upload errors, if you are looking for solving update failed errors while updating plugin/theme/core WordPress, then check this article.
1. Restricted File Types in WordPress
WordPress only allows you to upload certain type of file formats in your site as listed here. In other words, it does not allow uploading certain type of files like SVG and WOFF. If you try to upload restricted files, you will see an error message indicating you are not allowed to upload the file type.
If you still want to use SVG files, there are plugins like SVG Support that can help you out. For other file types, you may need to upload with FTP and then use the URL to insert on your site. Alternatively, you can use any third-party URL to embed it on your site if that works for you.
2. File Unsupported by Webserver
WordPress needs a paid hosting server and each server is different and needs a proper configuration. Generally, you need not worry about server configurations as the hosting company will setup the stuff for you. However, many hosting servers do not support file types like WEBP. With Google is pushing for site speed, you may try to upload webp images in your post instead of PNG or JPEG. What you will see is an error like below showing the image could not be processed by the web server.
There are plugins out there to generate webp images for you. However, they will not work if your server does not support the file type. Therefore, the only solution here is to upgrade the hosting plan to one of the supported servers so that you can use webp images. Alternatively, you can use third-party solutions like Cloudflare premium for generating webp images on the fly and serve to your visitors.
3. Limitation in Upload Size
Your web server sets a limit for file size that you can upload in your site. it could be an image or theme or plugin that you try to upload through the admin dashboard. You can go to “Media > Add New” and find the maximum upload file size limit mentioned below the upload box. You will get an error when trying to upload a large file than this allowed size.
The solution here is to change the file upload size in your php.ini file. Alternatively, you can discuss with the hosting company and get their help in increasing the upload size.
4. Firewall Blocking
Are you using Cloudflare premium plan or any other security plugins that apply firewall protection (WAF) to your site? Then it could be the reason for failure in file uploads. For example, Cloudflare automatically enables set of firewall rules to prevent uploading malicious code in your site. However, this will stop you from uploading themes and plugins from admin dashboard. The annoying part is that the firewall rule will even stop adding Google Analytics code in the plugin. You will see an error showing “Sorry, you have been blocked” as shown below.
Scrolling down the page will show you the error details from Cloudflare.
The solution here is to go to your Cloudflare account and analyze the WAF logs to find which rule is causing the blocking. Then you have to manually disable the rule temporarily and upload the file. If the rule blocks you consistently, then you may need to disable it permanently. Similarly, you need to do the same when using any other security plugins.
5. Large Image File Dimensions
WordPress also restricts the maximum allowed dimension for an image you upload. The maximum dimension is 2560×2560 pixels and any image you upload larger than this dimension will be scaled down to these dimensions. In some cases, you may see HTTP error showing the size exceeds the dimension. If you really want to keep large original images, then add the following code in your functions.php file.
add_filter( 'big_image_size_threshold', '__return_false' );
For additional information on using large images, check this WordPress documentation.
6. No Authorization to Upload Files
Missing authorizations can prevent you from uploading images/files and showing error. In some cases, your uploaded images and files will not show up in the media library though you can upload them successfully. Also, you will be able to upload themes and plugins without any problem. Go to “Settings > Media” menu in your admin dashboard and check whether you have enabled “Organize my uploads into month- and year-based folders” option.
This option is enabled by default which will create new folder for each month/year to store the uploaded files. At the start of month if the new monthly folder is not created for any reason, then all your file uploads will fail with authorization error. The solution is to create a correct folder through FTP and check the file permissions are set properly to show the files in frontend to all public. The default permission for all folders under “/wp-content/uploads/” directory is 755 and the individual files will have 644. You can setup the correct permissions and check if that resolves your file upload error.
Note: You will not be able to open files in the browser uploaded through a membership or ecommerce plugins. For example, an eBook file uploaded in WooCommerce product page will be stored under different folder with encryption. You will see authorization error when trying to open the protected files directly from browser.
7. Poor Internet Connection and VPN
The last problem, in fact you should check first, is your internet connection. There could be multiple file upload problems happen due to your internet connection.
- Slow network connection will halt the file upload and show you HTTP gateway timeout error.
- Uploading files through VPN or proxy may be blocked by your hosting server. For example, we use SiteGround Google Cloud platform which will block VPN access when trying to upload files through FTP.
Make sure you have stable connection and not doing multiple file uploads through different applications. This will especially help when you to try to upload large theme or plugin or image without error.
Leave a Reply
Your email is safe with us.