Post_max_size and upload_max_filesize on an individual basis
Using a PHP uploader and was wondering if there is a way to override the defaults in php.ini for post_max_size and upload_max_filesize in a specific script?
I don't want to change it universally in php.ini, because while it is good to make the limit large for the bootloader in our admin section, we don't want it to be a large limit in the public section.
source to share
You should be able to do this through your .htaccess file. Let's say you want to allow 10Mb download for admin area and 2Mb for public side. I set the default (in php.ini) to 2MB and then in the admin area add to the htaccess file:
php_flag upload_max_filesize 10M
Edit
This is intended to work at the directory level. I assumed your admin pages are running from mydomain.com/admin/ with a physical / admin folder in your web browser (where you put your .htaccess file).
source to share
Changing this value for the user is not possible unless you write a .htaccess file for each visit.
Why don't you just allow the download and discard it if it's too big?
I found this one , but I don't believe it as the HTML has no idea what you are doing with this input.
EDIT: Basically, since Apache is what handles the actual physical file transfer, you need Apache to be aware of any restrictions before the user submits the form. Since HTML has nothing to do with this, you cannot install it there, and since PHP is only useful when the file is actually on the server, you need to validate it after downloading it. Sorry, I realized that my first answer was a little vague. Hope this helps a little more.
source to share