- You might have faced situations where your current upload file size is not sufficient and you need to modify it to suite your requirement as default file upload size is limited upto 32MB only in WordPress.
- Maximum file upload size also depends on the web hosting company and the plan you have choose.
- Maximum file upload size limit can be seen on your media upload page in WordPress as shown in below image. Normally it ranges from 2MB to 32MB but for some media files such as audio/ video it is obviously not sufficient.
- So in this post, we will look how to modify maximum upload file size in WordPress.
Note: This is a basic level tutorial. It may not work with some shared hosts in which case you would have to ask your hosting service provider for support. Fore example, Godaddy has the following upload limits on shared hosting. Your default PHP upload limit depends on the type of hosting account you have (Click for more info):
|Type||Default upload limit||Max|
|cPanel||32 MB||No limit|
|Web||32 MB||128 MB|
|Classic||32 MB||64 MB|
- There are many ways to increase or modify file upload size such as using theme function file, using php.ini file or by using .htaccess file. We will try to explain each of these as below.
1: Theme Functions File
Sometimes we can modify upload file size just by simply adding the following line of code in the theme function’s file. The below line of code will set to maximum upload file size to 64MB. You can set as per your requirement.
@ini_set( 'upload_max_size' , '64M' ); @ini_set( 'post_max_size', '64M'); @ini_set( 'max_execution_time', '300' );
The PHP.INI file
You will not see a php.ini file in your directory if you are on a shared host, If this is the case then you can create a new file called php.ini and upload it in the root directory. Paste the following code into the php.ini file :
upload_max_filesize = 64M post_max_size = 64M max_execution_time = 300
We can also use .htaccess file to modify file upload size in WordPress. The .htaccess file may be available in the root directory. Open or create the .htaccess file in the root folder and add the following code:
php_value upload_max_filesize 64M php_value post_max_size 64M php_value max_execution_time 300 php_value max_input_time 300
Note: It is important to note that if you are on a shared hosting package, then these techniques may not work. If this is the case then you have to contact your web hosting provider to increase the limit.
- The upload limit does not guarantee an upload will complete — only that it isn’t rejected by the server.
- Uploads beneath the limit can still fail because of:
- Upload speed, which can cause timeouts from your PHP script or your browser
- Your account’s resource availability, which can cause large files to fail