[How To] increase the import file size limit for PHP applications

To increase the import file size limit for applications written in PHP, you can do the following:

  1. Locate and open php.ini file (use [How To] find php.ini file article for more details).

  2. Look for the following lines:

              upload_max_filesize = 2M
              post_max_size = 8M
            
  3. Change the values to the desired file size limit, for example:

            upload_max_filesize = 50M
            post_max_size = 50M
            
  4. Save the changes to the file and restart your web server for the changes to take effect.

  5. Test your application’s file upload feature to ensure the file size limit has been increased.

Alternative method

Alternatively, it is possible to set these values in .htaccess file in the root of the application:

php_value upload_max_filesize 50M
php_value post_max_size 50M

This will set these values for your application specifically and won’t affect other applications on the server.

Related

[How To] find php.ini file

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.