
Increase Maximum File Upload Size In WordPress
WordPress limits the size of media files you can upload to 2MB. Sometimes we need to increase the maximum file upload size in the WordPress Admin > Media to a number higher than this.
There are a couple of ways to do this. Be forewarned, if you are on shared hosting, these may not work. Shared hosting is only affordable because the server resources are throttled so heavily. If you are on decent hosting, one of these methods should work.
To see what your media upload limits are, go to Media > Add New in the WordPress admin. You should see a message like Maximum upload file size: 2 MB. The means for increasing your upload limit will depend on how your particular server is configured.
You will need to have FTP access to your server and WordPress installation. Before changing any files on your server, make sure you have your files backed up, so you can restore your original site if something goes wrong during this process.
Method #1: Modify the php.ini File
Most sites have a php.ini
file at the root of the server. Depending on the server configuration, it may be in the folder where your site is installed, or it may be a couple of folders above. Some servers have the root files at the top level, and sites in a folder called html or www. If a php.ini
file already exists, it may be in a folder called conf or etc.
If you already have a php.ini
file, open it via FTP with your text editor of choice. Find these following values and change them accordingly.
memory_limit = 64M
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300
This will increase the maximum file upload size to 64MB, and give PHP operations 300 seconds to execute, so large file uploads do not time out.
If no php.ini
file exists, create one and add the above values to it. Save it and upload it to your root (or WordPress root) folder.
Clear your cache and go to Media > Add New. You should see the new upload limits. If you are on a dedicated server, you may need to restart your server to see the changes.
If your server is running PHP 5, you may need to to create a file named .user.ini
and add the same values.
memory_limit = 64M
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300
Upload this file to your root folder and check the Media Upload screen for changes to your file size upload limit.
Method #2: Change .htaccess File
Your .htaccess
file is used to configure Apache server modules, but can be used to control PHP values. Make sure you have a backup of the original .htaccess
file in case things go sideways and you get the white screen of death. Simply upload your original .htaccess
to revert back to normal.
Open your .htaccess
file via FTP. Add these lines to the bottom of the file, save and upload back to the server.
php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300
Go back to the Media > Add New screen to see if your changes have taken effect. If things go bad in any way, upload your original .htaccess
file.
Method #3: Edit the wp-config.php File
If the first two methods haven’t increased your maximum file upload size, there’s one last thing to try — editing your wp-config.php
file. Since this file controls the installation of your entire site, make sure you have your site files backed up before proceeding with this method.
Open up the wp-config.php
via FTP, and at the bottom, or below the Nonces and Salts, add the following line:
define('WP_MEMORY_LIMIT', '64M');
Navigate to your functions.php
file in the wp-content folder ( or Appearance > Editor > Functions in the WP Admin). Add the following lines at the bottom.
@ini_set( 'upload_max_size' , '64M' );
@ini_set( 'post_max_size', '64M');
@ini_set( 'max_execution_time', '300' );
Go back to the Media > Add New screen to see if your changes are in place.
If None Of These Work
If none of the above methods successfully increase the maximum file upload size on your WordPress site, then it’s time to contact your hosting company. They may certain server configurations in place that are preventing you from uploading files larger than 2MB in size.
Thanks dude it worked !!! Thanks a lot.
No problem, Rishi. 🙂