Breaking upload restriction in PHP

By default, maximum upload size in PHP is 2Mb. However if u need to upload bigger files, you just need totweak your php configuration.

1 word of caution, first confirm where your php configuration file lies. To check this, make a simple php test file in your server with


echo phpinfo();


Now run this file in your server(I dont think i’ve to explain what you ought to do here). This will display your current php configuration. In the page look for Configuration File (php.ini) Path. This is where your php configuration file resides.  In the same page look for two things:

1. upload_max_filesize

2. post_max_size

You’ll see default (or whatever you’ve specified) upload size. These are the things that you need to change.

Next thing open up your php configuration file(look in the path as shown in phpinfo page) and look for above two configuration ( upload_max_filesize & post_max_size). Now change the values to suit your need (I’ve made both to 128M, meaning I can upload upto 128 Mb..but thats just for tesing only).

Look for another configuration called memory_limit in the same php configuration file and change it to your need  (in mycase 128M), save the file and restart your server. You can now upload bigger files aswell..

Do enjoy.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s