Uploading files on WordPress is a common action taken during the course of running a website and adding new content. Whether it’s a brand new theme, a bulky PDF eBook, or a locally-hosted video,uploading large files often ends up with an error: Request Entity Too Large.
This error is also known as the 413 error and it has to do with the size of the file you are uploading. This article will present the causes behind the Request Entity Too Large error and how you can fix it.
As the name of the error says, the file is too large to be uploaded onto the site. The upper limit is established by the web hosting that you are using – on shared hosting, there’s almost always a pretty low default limit. Whenever a file exceeds that limit, the server returns the Request Entity Too Large error.
Setting an upper limit is a requirement to keep the server working smoothly, although some web hosting companies set absurdly low limits, so you may encounter this error on even relatively small files.
If you want to raise the limit, you’ll have to take matters into your own hands. Read on to learn more about the 413 error and possible solutions.
Generally, web hosting companies configure their servers based on how many websites they host on a single shared server. The more websites they host, the more resources are consumed. This means that the size of uploads has to be restricted to keep all users of the server happy.
The 413 Request Entity Too Large error appears whenever the server cannot process the entire file in a single HTTP request, due to restrictions set by your web host. When you make a request that doesn’t meet the size limit, the 413 response will pop up.
Setting an upper limit is a normal and recommended practice to keep the server up and running, without consuming all of its resources. Although your particular web host may prevent you from changing the limit, most hosts do allow you to change it manually.
The following section will present a few methods to fix the Request Entity Too Large error.
You can try a few of the solutions listed here and see if you can alter the HTTP request size allowance. If you don’t want to run these steps on your own, you can always contact your web hosting company and let them handle the issue instead.
The first option is modifying the functions.php file. This file is located in your WordPress Themes folder. The file is responsible for defining classes and actions on a WordPress website.
Simply put, it is the file behind features such as enabling thumbnails, changing post formats, and setting up navigation menus. To modify this file, you need to:
1. Log in to your cPanel account and navigate to File Manager
2. Open the public_html directory
3. Find the folder named “wp-content”
4. Open the folder and look for Themes
5. In the Themes folder, look for the name of your active theme
6. Open your active theme folder and search for the functions.php file
7. Once you found it, right-click the file and select edit
8. When the dialog boxopens up, paste this code:
@ini_set( 'upload_max_size' , '64M' ); @ini_set( 'post_max_size', '64M'); @ini_set( 'max_execution_time', '300' )
The code above will increase the maximum upload size to 64M, as well as increase the execution timeout value (some servers can take a long time to process large uploads).
Depending on what types of files you are trying to upload, you can increase it even more, to 128M. To do so, simply replace 64 with 128.
9. Save the changes and reload your website
Note that you can also add this code to functions.php through your WordPress admin dashboard with the theme file editor. This is not recommended, though, as a small mistake may break your site and you won’t be able to access the admin area to revert the change.
Another solution would be to change the .htaccess file, which is probably the most important file of a WordPress site. This file is responsible for configuring access to all the files and folders of the site itself. You will have to be careful when editing it.
Follow these steps with care:
1. Log in to your WordPress Dashboard
2. Find the public_html directory corresponding to your website’s domain (in case you own more than one website)
3. Open the directory and look for the .htaccess file. You can edit it by right-clicking it.
4. You will be asked to disable encoding – click Edit
5. The new tab that appears will let you edit the .htaccess file. This is where you need to paste the following lines:
php_valueupload_max_filesize64M php_valuepost_max_size64M php_valuemax_execution_time 300 php_valuemax_input_time 300
6. Save the changes and refresh your website
On WordPress sites that use Nginx instead of Apache, there is a directive called “client_max_body_size”, which is responsible for the maximum HTTP request size– the main cause of the 413 Request Entity Too Large response.
This directive is defined in the file called nginx.conf. You can find this file at /etc/nginx/nginx.conf.
Keep in mind that you’ll need to initiate an SSH console connection with your server to perform this method completely, which may not be available on shared hosting. In which case, you’ll have to contact your hosting company.
You will need these lines of code to modify the size:
# set client body size to 8M # client_max_body_size8M;
The default value is 1M, and these lines of code change it to 8M. To set no request limit at all, you can set the value to 0. After making the changes, save the file and reload Nginx on your SSH or VNC console with this command:
# servicenginx reload #
If none of the options listed above worked and Request Entity Too Large continues to occur, then you might want to try uploading your file via an FTP client. FTP stands for File Transfer Protocol and it is a program that lets you transfer/upload files from your computer to your website.
To use an FTP client, follow these steps:
1. Load your preferred client (e.g. FileZilla) and connect to your server
2. Navigate to the public_html directory
3. Go to Plugins/Themes
4. Open any of these folders, based on what you need to upload
5. Unzip the contents of the plugin or theme that you want to upload and go to the appropriate location in your FTP client
6. Locate the folder and drag and drop it where you want it to be
7. Save the changes and you’re done
Obviously, it’s much easier to upload files directly from your WordPress dashboard instead of doing it the long way around with FTP. The Request Entity Too Large error can be very annoying and make you waste precious time that you could invest in other activities.
You should do your best to solve the HTTP request size problem once and for all instead of using an FTP client each time you want to upload a file. Choose a straightforward method to change the upper limit and you will be all set.
If everything else fails, contact your web hosting company and have them modify the numbers, so that you will no longer struggle with the Request Entity Too Large response.
Free cheat sheets available
Subscribe to download a set of cheat sheets for CSS, JS, and HTML
You'll receive an email with the cheat sheets in an instant.