I was wondering if you can set the post_max_size
only for a specific page or function (in the php.ini
)?
You can set it in the .htaccess
php_value upload_max_filesize 4M
php_value post_max_size 4M
but it doesn't work for a specific page. Also the ini_set()
doesn't work for a specific page.
Any suggestions?
You cannot change the upload_max_filesize
at runtime. If you want custom limits for different parts of your app/website you have to set the upload_max_filesize
& post_max_size
to the maximum value that you want to allow, and after that you have to manually force lower limits with function filesize()
for example: you set upload_max_filesize
& post_max_size
at 100M, and you can manually reject an upload larger that 50M at a specific page/function by checking the size of the file