Uploading a file that exceeds the maximum file upload limit fails to upload and create an error. The maximum file upload limit depends on the hosting and the package that you are using. The maximum upload size can vary from 2 MB to 150 MB. Clearly, the maximum upload size of 2 MB is very low and is not sufficient for most of the time.
How to check the maximum upload file size
To check the maximum upload file size, go to Media > Add New to your WordPress website. You can see the current maximum upload file size on the bottom of the upload window as shown in the screenshot.
Increase the maximum upload file size
If your current maximum upload size does not meet your upload requirements, there are ways to increase the maximum file upload size. They are mainly the following:
- Edit the theme’s function.php file
- Create or edit the php.ini file
- Update .htaccess file
- Contact your hosting provider
Edit the theme’s function.php file
You can increase the maximum file upload size limits using the function.php file. On your WordPress dashboard, go to Appearances > Editor > function.php file. On a new line, add the following lines of code. Replace the memory parameter as per your requirements.
@ini_set( 'upload_max_size' , '64M' ); @ini_set( 'post_max_size', '64M'); @ini_set( 'max_execution_time', '300' );
Edit the php.ini file
If you are able to see the php.ini file in the root, then open the file in a text editor. If you are not, create a new file named php.ini. Add the following code to the file and change the values to according to your requirements. Now save and upload it to the root folder.
upload_max_filesize = 64M post_max_size = 64M max_execution_time = 300
Updating the .htaccess file
Head to the root directory and open the .htaccess file in the text editor. Adding the following code to the .htaccess file with your memory requirements can increase the maximum upload size in WordPress.
php_value upload_max_filesize 64M php_value post_max_size 64M php_value max_execution_time 300 php_value max_input_time 300
Contact your hosting provider
If the above solutions do not work for you, then the last resort is to contact your hosting provider and ask them to increase your maximum upload size limit.