How To increase maximum file upload size in php or in wordpress?

Sometime, you require files larger than 2 MB to upload on your PHP websites, which it does not let you do by default. Showing it is over the limit. In PHP, default upload size is 2MB, which is already set in “php.ini” file.

But What if you need to upload file larger than 2 MB? if you are using WordPress, at some point you have faced this problem.

To increase the maximum upload size in php, you need to change “upload_max_filesize” value which is set to 2MB by default.

if you are using xampp server in UBUNTU than php.ini file will be found at

  opt/lampp/etc/php.ini

if You are using Xampp Serve in window than php.ini file will be located in

C:/xamp/php/php.in

then find “upload_max_filesize” in php.ini and increase its size. default size for uploading file is 2 MB as I mentioned earlier.

set Upload_max_filesize=8M or whatever MB size u like.

if you are uploading file greater than 8MB then You Need to change “post_max_size” in php.ini, hence that settings allows php to handle post request to specified Mb size.

set  post_max_size=20M  or whatever MB size you like.

However, it’s not done still. you also need to consider the time that file upload takes. default execution time is 30s. If your file is large, than it requires some more time to be uploaded. you can set it by changing “max_input_time” and “max_execution_time” to something 300 (which is 5 mins).

max_input_time=300

max_execution_time=300

If you make that change, than it will apply to all applications inside htdocs. Now, what if you want it for particular app, than you need to put .htaccess file in it or have to modified it if already exist.

changes to .htaccess file for cpanel user to upload larger file.
php_value upload_max_filesize 10M

php_value post_max_size 10M

php_value max_input_time 300

php_value max_execution_time 300

.htaccess setting to upload larger file

or you can also set this setting in your index.php file as follow.

ini_set('upload_max_filesize', '10M');
ini_set('post_max_size', '10M');
ini_set('max_input_time', 300);
ini_set('max_execution_time', 300);

You can increase or decrease file upload size using this settings in php. If you liked this blog or want to know anything related to this setting than feel free to ask in comment section below.

Latest

Oppo F5: Finally a found a change, but yet to see originality

Oppo has finally changed their smartphone look with the new arrival of Oppo F5. Oppo is widely known for their selfie-centric phones. They did not…..

What is the function of Pause/Break button?

Did you ever thought that what does the Pause/Break button do? Is it to use when you are stuck at work and waiting for a…..

Google Pixel 2: All the Rights and Wrongs at one Place.

Google recently announced their new Google Pixel Smartphones. With a more modern design, a larger screen, and battery and an exclusive paint job. What could…..

Should I turn off PC without Shutting Down?

When you consider about turning something off, it is just as simple as pressing switch. You can just flick the switch, rotate the key for…..

How to disable Auto Update in Windows 10?

For some people, Auto update in Windows OS is very annoying. Especially, when you got a limited data connection. So, you have to turn Auto update…..

How To increase maximum file upload size in php or in wordpress?

Sometime, you require files larger than 2 MB to upload on your PHP websites, which it does not let you do by default. Showing it…..

Data Breaching and Hacking Preventions

Recently,  number of cases of getting Credit card or bank account hacked has grown too much. So, probably this is a great time to talk…..

What is the largest possible Size of a Single File?

Kids from 2000s, you may not remember a time before a 120 GB hard drives were the bare minimum, but other of you from 90s…..

File Systems: What is FAT and NTFS? Which one is better?

You probably know someone, who is always miss placing stuff, I do personally. Whether they can not find their keys in the morning, they leave…..

App Review: MoveIt – transfer Media Files Automatically

From the title of the blog, you will think that, what is new in that? But well, there are some features in this you will…..

Status Forever: Android App to get Status for every mood

Are you looking for new Status to put on your Social media account? Whether you are feeling sad or true love, you will get all…..

Vivo Y69: Review and Specifications

The Chinese smartphone manufacturer Vivo always try to give you good and better Camera. Which is boring in a way. You just don’t get any…..

Apple iPhone X: Top 5 Features, Dream Project of Apple

If you have followed Apple at all, you have probably heard the old cliche that it does things better, instead of doing them first. Nowhere…..

How AHCI or IDE Modes can affect the Drive Performance?

When you finally decide to address a huge bottleneck in your computer by upgrading to an SSD for your Boot drive. But when you finally…..

Technical Terms that you don’t have an Idea of being Misused

Using the word Bacteria to refer to a single germ, which should be bacterium instead, mixing up Discrete and discreet and saying my Facebook got…..

How Important System32 Folder is for Windows OS?

Warning! Deleting this file can cause damage to Windows or another Program. Odds are pretty high that you have seen a message like that, if…..

Samsung Galaxy Note 8 First Impression: Do Bigger Things

Last year’s Galaxy Note 7 was perhaps “the most famous Samsung smartphone in history”, for all the wrong reasons. The company kicked off its recovery…..

Top 6 Upcoming Smartphones of 2017

2017 has been an incredibly exciting year, when it comes to smartphone launches. But that doesn’t mean, it will not get even better. So, Let’s…..

Mobile Networks: Evolution from 1G to 4G Explained

Most of us uses smartphone with 3G or 4G mobile networks, well mostly 4G after Jio Storm. But do you ever think what does it…..

Lenovo K8 Note: New Killer Note is ready to Kill the Ordinary

Chinese Mobile manufacturer Lenovo made a great success with their Lenovo K series. Especially with Lenovo K3 Note, Lenovo K6 Power and Lenovo K6 Note……

Top Trending

  • Get more stuff like this
    in your inbox

    Subscribe to our mailing list and get interesting stuff and updates to your email inbox.