How to Increase the Maximum File Upload Size in WordPress

By default, WordPress has a modest limit for uploading images, videos, and other files. It’s a similar story for your PHP memory limit, which helps you run plugins and scripts. For some it is as low as 2MB which is clearly not enough for media files like (audio / video). Most pictures are under 2MB, so it is fine for just pictures. In this article, we will show you how to increase the maximum file upload size in WordPress.

There are 3 ways for you to increase the maximum upload file size for your WordPress site.

Depending on your web host and the package you’ve chosen, there will be a maximum upload file size set (originally set to around 8mb) which you will be able to view when trying to upload files to your Media Uploader in WordPress.

1: Theme Functions File

If the host allows, you could simply increase the file upload size and max execution time by adding the following code into your functions.php file

@ini_set( 'upload_max_size' , '64M' );
@ini_set( 'post_max_size', '64M' );
@ini_set( 'max_execution_time', '300' );

To see if the changes have taken effect go back to your Media upload page and refresh the page.

2. Create or Edit an existing PHP.INI file

Generally if you are on a shared host you will not see a php.ini file in your root directory, but if you do then you can search for each of the following lines within the file and then change the values to what you need.

upload_max_filesize
post_max_size
max_execution_time

If you do not see a php.ini file in your root folder then you can (apparently, I haven’t done this before) create one and add the following lines of code to increase your limits.

upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300

On some servers these changes will take effect immediately while on other servers it can take longer because the server might be caching the files. If the changes do not work after a little while you can also try renaming the file to php5.ini

To see if the changes have taken effect go back to your Media upload page and refresh the page.

Note: Move a php.ini file to your wp-admin folder

3. htaccess Method

Some people have tried using the htaccess method where by modifying the .htaccess file in the root directory, you can increase the maximum upload size in WordPress. 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

Again, it is important that we emphasize that if you are on a shared hosting package, then these techniques may not work. In that case, you would have to contact your web hosting provider to increase the limit for you. Some hosts completely turn down their users.

Drop Your Comments Below

Leave a Reply