6 December, 2021

How To Increase Upload Limit Via PHP

In most of the servers, the file upload size would be restricted between 4 MB to 8 MB. However, we have some options through which we can increase the maximum upload size.

Option 1: You can overwrite the php settings by using php.ini in your domain root directory. Open notepad and paste the below code and save the file as php.ini file.

safe_mode = off;
file_uploads = on;
session.cache_expire = 4000000000;
upload_max_filesize = 1000M;
post_max_size = 1010M;
max_execution_time = 40000000;
max_input_time = 40000000;
memory_limit = 1010M;

If it does not work, you may try by placing the php.ini file in your directory which executes upload process.

Option 2: If your server administrator restricted the usage of php.ini then you may overwrite php settings using .htaccess file. Open notepad and paste the below code and save the file as “.htaccess” file and place it in the domain root directory.

php_flag safe_mode off
php_value max_execution_time 1000
php_value session.gc_maxlifetime 14000
php_value output_buffering on
php_value upload_max_filesize 104857600
php_value post_max_size 104857600
php_flag display_errors off

If both the above options does not work, then you may need to ask your server administrator for increasing file upload size.

Share

Punith is Digital Marketing Head at Contus. He has worked with startups since 2005 to market their products and services. Along with the passion for analytics and marketing he enjoys offering strategic digital and inbound marketing solutions.

3 Comments

  1. cesar Reply

    ok, but I wondered about the type of server to upload the files because the program will turn into flash? or extensions to stay with the rose?
    upload videos to change them to flv or playing with another extention?

    I speak Spanish sorry and I am using the translator, I hope and understand my question
    thanks

  2. bhavesh Reply

    i set the code in root create php.ini byt its conflict by server nad my site is Given Error.so please find the other ways to implement php.ini in my store .Suggestion for that

Leave a Reply

Your email address will not be published. Required fields are marked *