How to Upload Files Bigger Than 2mb to Wordpress
How to Increase the Maximum Upload File Size in WordPress
Do you want to increase the WP max upload file size in your site but you're not sure how? We've got you covered. In this guide, you volition learn different methods to change the maximum file upload limit in WordPress.
Why Increase the Maximum Upload File Size?
If you have a site or an eCommerce shop, you're probably familiar with the process of uploading media. Normally, you lot do information technology via the library and you can upload images, GIFs, ZIP files, and more. The problem comes when your file size is too big. What'south too big? If your file size is bigger than the maximum file upload size configured in the server, yous will experience issues.
For example, if you try to upload a 20MB file through the media library but your maximum file upload size is 10MB, it won't work. You'll get an alert saying that the file size limit was exceeded. And unless yous increment the maximum upload file size on your WordPress site, y'all won't be able to upload that file. This can be a headache for websites that need to upload videos and high-resolution images.
The good news is that there are several means to prepare this problem. In this guide, we'll show you how to increase the upload limit in WordPress. But before that, let's run into how to check what the current maximum upload file size is on your site.
How to Cheque the Max Upload File Size
Earlier raising the upload limit, check what your current limit is. In your WordPress dashboard, go to Media > Add New. There, you will see the maximum file size that you can currently upload.
In most cases, the maximum upload limit is set by your hosting provider. For instance, for us, the file size is 128MB but some WordPress hosting companies set this value to 2MB by default.
How to Increase the Maximum Upload File Size in WordPress
There are several ways to increase the maximum upload file size limit in WordPress:
- .htaccess File
- Functions.php File
- PHP.Ini File
- WP-Config.php File
- Increase Size in Multisite
- With Plugins
- From the Hosting Platform
- Upload_Size_Limit Filter
- Contact your Hosting Provider
In this section, we'll explain each method step-by-footstep so you lot can choose the ane that best suits your needs.
NOTE: Some methods require editing the theme files or WordPress core files, and so before you start, nosotros recommend you lot generate a consummate backup of your site. If y'all're non sure how to practice it, check out this step-by-stride guide.
1) .htaccess file
By editing the .htaccess file, yous volition exist able to increase the maximum file upload limit. To practise this, you need to apply an FTP client like FileZilla, so first install FileZilla on your local computer. After that, connect FileZilla with your web server.
You volition need to create an FTP account using your website's cPanel (command console) and then, you lot will be redirected to the file manager.
The left side shows you all the local files bachelor and on the right side, you will encounter the server files, where you should exist able to locate the .htaccess file.
Right-click on information technology and select View/Edit.
The software volition open the file on the text editor you have on your computer. In our example, it'due south Notepad.
Now copy this lawmaking to increment the file size limit to 128 MB.
php_value upload_max_filesize 128M php_value post_max_size 128M php_value memory_limit 256M php_value max_execution_time 300 php_value max_input_time 300
Paste information technology in the .htaccess file and save information technology.
Then, upload the file dorsum to the server. Yous will see a pop-up where you have to click the option to terminate editing and delete the local file and then ostend.
That'due south information technology! From now on, the maximum file upload limit will be 128 MB or any other size that you lot've configured through the lawmaking. We chose 128MB equally the maximum upload size only you tin can change it and suit the value to any size you desire.
2) Functions.php file
If you lot're not comfortable editing WordPress core files, you can also upgrade the maximum file upload limit by editing the theme files. To practise that, y'all demand to edit your kid theme's functions.php file. If you don't have a child theme, we recommend y'all create one following this tutorial or utilize whatsoever of these plugins.
In that location are two options to edit your child theme files:
- Via the WordPress editor
- With plugins
Both methods will get the job done without issues. Here, we'll explain how to apply both so you tin can choose your favorite one.
Method i: Edit Functions.php file from WordPress Customizer
First, log in to your WordPress site and go to Appearance > Theme Editor.
Past default, your server volition load the style.css file. We'll edit the functions.php file and then look for it on the right-hand side of the screen.
And then, copy this code to increment the file size limit to 64MB.
@ini_set( 'upload_max_size' , '64M' ); @ini_set( 'post_max_size', '64M'); @ini_set( 'max_execution_time', '300' );
Paste it in your functions.php file and update the file.
In this example, we have chosen 64MB equally the max upload size but if y'all want a different file size, just update the code. For example, let's say you lot want to be able to upload files upwards to 100MB. The lawmaking will be:
@ini_set( 'upload_max_size' , '100M' ); @ini_set( 'post_max_size', '100M'); @ini_set( 'max_execution_time', '300' );
On the other paw, if you don't experience comfortable editing the theme files, check out the plugin method below.
Method 2: Code Snippets Plugin
Code Snippets is one of the best plugins to add code for those who don't like to edit core/theme files directly. To install this tool, in your WordPress Admin, get to Plugins > Add New, look for Code Snippets. Then, install and activate the plugin.
After that, y'all will be able to add custom PHP/ HTML/ CSS or JavaScript codes through the plugin settings. But get to Snippets > Add New on the sidebar.
Every time you create a snippet, nosotros recommend you requite it a clear name that explains what it does and so then it'south easy to identify. For example, nosotros'll call it "Increase Max File Upload Time". After that, copy the code from below, paste it in the plugin'south snippet section and save information technology.
@ini_set( 'upload_max_size' , '64M' ); @ini_set( 'post_max_size', '64M'); @ini_set( 'max_execution_time', '300' );
That's it! You've but increased the maximum file size limit to 64MB.
3) PHP.Ini File
Some other alternative to increment the maximum file size limit in WordPress is to create or edit the php.ini file.
Outset, copy the below code to increase the limit to 128MB.
upload_max_filesize = 128M post_max_size = 13M memory_limit = 15M
Then, open any text editor (Notepad, Notepad++, Sublime Text, or any other) and paste the code. And then, save it as php.ini (.ini is the extension here) and place it somewhere handy.
Once you have created this file, log in to your website'south file manager through cPanel or FileZilla and upload this php.ini file to your WordPress installation directory. That'southward it!
4) WP-Config.php File
The wp-config.php file is a core file that contains essential information such every bit the MySQL username, hostname, password, and so on. Additionally, it has information regarding the upload size limit, so we tin can edit information technology to increase that limit.
To do that, log in to your file manager using FileZilla. In the WordPress installation directory, you volition run across a file chosen wp-config.php. Right-click on information technology and select View/Edit.
And then, open the file using whatsoever text editor and re-create the post-obit code to increase the file limit size to 120MB.
@ini_set( 'upload_max_size' , '120M' ); @ini_set( 'post_max_size', '13M'); @ini_set( 'memory_limit', '15M' );
Afterwards that, paste the code right before the line That's all, stop editing! Happy blogging and save the changes.
And so upload the file back to your server and that's information technology! You've increased the file size limit by editing the wp-config.php.
five) Increase Size in Multisite
If you accept a multisite WordPress installation and desire to increase the maximum upload file size, follow these steps.
Starting time, in your dashboard, get Network Admin >Settings.
Under the settings, search for the Max upload file size selection.
Here, the server is configured with a max 1500 kb (or i.5MB) file upload limit then we'll increase it to 64MB (64000 kb).
Finally, save the settings and you are good to go.
6) Increase the maximum file size upload limit with plugins
If you don't feel comfortable editing files, you tin increase the file size limit with a plugin. For this demo, we'll utilize a free tool chosen Increase Maximum Upload File Size.
The first thing yous need to do is install and activate the plugin.
So, get to the plugins' configuration under the Settings section.
Now, just select the size you want from the dropdown and save the changes.
Every bit you tin can meet, the size options are: 16MB, 32MB, 64MB, 128MB, 256MB, 512MB, 1GB. Keep in mind that you can't select a different file size, so you'll have to choose one of those options.
Finally, save the changes and you will see the new limit configured. Short and sweet.
seven) From the Hosting Platform
Most WordPress hosting companies volition requite you an option to configure the maximum file upload size through the cPanel or your account dashboard. Let's see how you can do information technology.
Start, log in to your cPanel and get to Software >Select PHP Version.
You lot will be redirected to the PHP extensions page and from in that location, you will be able to enable or disable custom PHP extensions. Nosotros don't demand to change any of this but on the top-correct corner, click the link to open the PHP options.
On the side by side page, yous will see the PHP selector options. These are the settings people use to modify the PHP version but we'll use them to edit the maximum file size.
You need to locate the upload_max_filesize choice. That's the max file upload limit configured by the server or hosting company. Just click information technology and select the maximum file size you desire to utilise from the dropdown. After that, save the settings.
Note: Be extra careful when irresolute this type of matter. Modifying the incorrect settings can affect your site'due south frontend/backend, so double-bank check every step and proceed carefully.
8) Upload_Size_Limit Filter
WordPress includes a filter to increase the upload size called Upload_Size_Limit. You lot can use it to edit your theme'due south functions.php and add together a filter to customize your maximum upload file size. Allow'southward see how to do it.
Log in to your WordPress site and go to the Theme Editor. Open the functions.php file and paste the below code at the terminate of the file.
function filter_site_upload_size_limit( $size ) { return 1024 * 1024 * 64; } add_filter( 'upload_size_limit', 'filter_site_upload_size_limit', 120 );
If you check the code, you lot'll come across that in the last line, nosotros specify a maximum upload size of 120MB. You lot can edit it and select any size you want for your site.
Finally, recollect to update the file after modifying the theme's functions.php file.
ix) Contact your Hosting Provider
It's worth mentioning that if you lot employ shared hosting, these methods may not piece of work. So if yous don't similar any of the previous methods or y'all use shared hosting, contacting your hosting provider is your best choice. Most hosting companies offering support via live chat, phone, and ticketing systems, and so simply tell them what you lot want to change and they'll do information technology for you.
Bonus: Add together custom epitome sizes
Autonomously from increasing the maximum upload file size, you tin also add custom paradigm sizes to make ameliorate use of your site's resources.
Beginning, y'all can change the default epitome sizes by going to Settings > Media in your WP dashboard. There, y'all will come across the 3 default sizes with their corresponding width and elevation. Merely accommodate the sizes and relieve the changes. We likewise recommend you regenerate the thumbnails.
If apart from changing the default options you want to add your own custom image sizes, y'all'll need to practice a scrap more work. The easiest way is to follow this step-past-stride guide that shows you 2 different methods.
Alternatively, you lot tin remove default image sizes that y'all don't use. To know more than about that, have a look at this guide.
Decision
In summary, if you endeavour to upload a file to your site that'due south bigger than the limit configured in the server, you will have issues. That's why learning how to increase that limit is very handy and volition assist you avert headaches.
In this guide, nosotros've seen several different methods to increase the maximum upload file size in WordPress:
- .htaccess
- Functions.php
- PHP.Ini
- WP-Config.php
- Multisite
- Using plugins
- From the Hosting Platform
- Upload_Size_Limit Filter
- Contact your Hosting Provider
All of these methods get the job washed efficiently so choose the one that y'all like best. The nigh common solutions are editing the .htaccess file, the wp-config.php, the php.ini file. Yet, if you utilise shared hosting or you lot're non comfortable using whatsoever of the above methods, yous can contact your hosting provider and inquire them to enhance the limit for yous. Additionally, some hosting companies even let you to update the upload size through the account dashboard.
On the other hand, if you don't feel comfortable direct editing the theme or WordPress core files, yous can use Code Snippets.
Have you enjoyed the read? Please share this postal service on social media and aid your friends increase their server's maximum upload file size!
Source: https://quadlayers.com/increase-the-maximum-upload-file-size-in-wordpress/
0 Response to "How to Upload Files Bigger Than 2mb to Wordpress"
Postar um comentário