If you are new to WordPress and you’re building a website for yourself. Sometimes, you might face some problems while uploading media files exceeding the size of 25MB due to certain limits on hosting platforms.
These limits allow WordPress to control the file size that is uploaded on the website and save us from heavy bandwidth costs.
Sometimes it happens that we want to upload large files and the error is preventing us from uploading the changes, so now we can increase the limit to our will in order to upload large files. It’s actually pretty simple to increase the Maximum Upload File Size in your WordPress Website by adding a couple of lines to your website.
You will usually face 500 Internal Server Error at the most unwanted time.
Usually, web hosting providers set the maximum upload size in WordPress Ranges from 2MB to 150MB depending on the host servers.
How To Check Current Maximum Upload File Size?
To check the current max upload size limit in your WordPress site, navigate to
WP Admin Dashboard -> Media -> Add New
You’ll see the current max upload size at the bottom as shown in the screenshot.
Best way to Increase Maximum Upload File Size in WordPress?
Method 1: Update “.htaccess File”
If you’re using Apache Web Server coupled with PHP, then you can increase the maximum file upload size by adding a few lines of code in your WordPress .htaccess file.
To access your .htaccess file, you’ll need to connect to your server via FTP Client or use cPanel’s File Manager and navigate to the root folder of WordPress Installation. Open up .htaccess in a code editor like VSCode or NotePad and add the following lines at the end.
php_value upload_max_filesize 64M php_value post_max_size 128M php_value memory_limit 256M php_value max_execution_time 300 php_value max_input_time 300
This will define the max upload size in MegaBytes. Replace numbers as per your requirements for further increments. The max execution time and max input time are in seconds.
Method 2: Edit Functions.Php File
If you’re not able to access the .htaccess file and are comfortable editing WordPress Theme Files. You can easily increase the max upload size limit by adding a few lines of code in the functions.php file of your theme.
However, it’s not a recommended method to choose because if you change the theme then the max upload size will return to its default size until you edit the functions.php file of the newly activated theme.
@ini_set( 'upload_max_size' , '64M' ); @ini_set( 'post_max_size', '64M'); @ini_set( 'max_execution_time', '300' );
Method 3: Create Or Edit Existing Php.Ini File
php.ini file is the default file used to configure any application which runs on PHP. This file contains every parameter required for file timeout, upload size, and resource limit.
To edit a php.ini file, connect to your server via FTP Client or use cPanel’s File Manager and navigate to the root folder of WordPress Installation. Look for the php.ini file in the root directory. If you don’t find one, create a new file called “php.ini”, add the codes given below in it and upload it in the root directory.
upload_max_filesize = 25M post_max_size = 25M memory_limit = 15M max_execution_time = 300
Note: If you are using a shared hosting service, you won’t find a “php.ini” file, instead you’ll need to edit these settings from your cPanel.
Method 4: Configuring Php.Ini From CPanel
As mentioned above, if you’re using shared hosting, this is the simplest way to increase your Max Upload Size.
To do so, you’ll need to access your shared hosting cPanel account, then go to “Select PHP Version” -> “Options”. Here you’ll find every PHP-related setting that you can tweak for the enhanced WordPress Experience.
Method 5: Contact Your Hosting Provider
If you don’t want to edit the files yourself, you can always contact your hosting provider to do it for you.
Right now, we use FastComet for hosting our websites, and they are superb at their job. All of my tickets are generally solved within an hour or two. They offer reliable WordPress Hosting at cheap rates low as $2.69/month.
I hope you’ll like the guide to maximizing your Max Upload File Size Limit. See you guys in the next one.