Appearance
How to set upload_max_filesize in .htaccess?
To set the upload_max_filesize directive in an .htaccess file, you can use the following code:
How to set upload_max_filesize in .htaccess file?
apache
php_admin_value upload_max_filesize 20MThis will set the maximum allowed size for uploaded files to 20 megabytes. You can change the value to whatever you want, just make sure to include the appropriate unit (B, K, M, or G).
Note that the .htaccess file must be placed in the directory where the PHP script that handles the file upload is located. If you want to set this directive for your entire website, you can place the .htaccess file in the root directory of your website.
Additionally, you may need to make sure that the AllowOverride directive is set to All in your Apache configuration file (usually located at /etc/apache2/apache2.conf or /etc/httpd/conf/httpd.conf) for the .htaccess file to be recognized and used.
How to make sure that AllowOverride directive is set to All in the Apache configuration file?
apache
<Directory /path/to/your/website>
AllowOverride All
</Directory>Important: The php_value directive was removed in PHP 5.4 and only works with the deprecated mod_php module. For modern PHP-FPM environments, you should set upload_max_filesize in your php.ini file or create a .user.ini file in your project root with upload_max_filesize = 20M.
Finally, keep in mind that the upload_max_filesize directive is just one of many directives that you can set in an .htaccess file. You can find a list of all available directives at the following URL:
http://php.net/manual/en/ini.list.php