PHP upload filesize limit Print

  • 46

Title: How to Adjust PHP Upload File Size Limit in Hosting

Introduction: In some cases, you might want to increase the PHP upload file size limit for your website hosted on This article will explain how to adjust the "upload_max_filesize" and "post_max_size" PHP variables using the .htaccess file.


1. Locate or create a ".htaccess" file: In the directory where your script is located, find the ".htaccess" file. If it does not exist, you can create a new file with that name.

2. Edit the ".htaccess" file: Open the ".htaccess" file in a text editor and add the following lines to adjust the "upload_max_filesize" and "post_max_size" PHP variables:

php_value upload_max_filesize xM
php_value post_max_size xM

Replace 'x' with the desired file size limit in megabytes (e.g., 20M for 20 megabytes).

3. Save the changes: Save the ".htaccess" file and upload it to your server if you made the changes offline.

4. Test the new settings: Verify that the new file size limits are in effect by testing your script or application.

Note: While you can change the "upload_max_filesize" and "post_max_size" PHP variables for your account, the server default values will remain unchanged. Keep the new values at a reasonable level to ensure optimal performance.

Conclusion: By following these steps, you can easily adjust the PHP upload file size limit for your website hosted on

Was this answer helpful?

« Back