We need to upload using the web interface on a PHP-based application sometimes. We have to set an upload limit by which we can allow a domain/directory to upload the file/image or anything from the web interface. We can do this using php.ini.
On the Windows 2003 server, we are able to set a custom php.ini file for a particular domain/directory but on the Windows 2008 server we are unable to do this for individual domain directories.
Here are the steps which we need to follow to set the upload limit for PHP at the server end:-
1. Locate your php.ini file (can find it in the root drive under the PHP folder).
2. Open the php.ini file in Notepad.
3. Search or find the following “upload_max_filesize” (the maximum allowed size for uploaded files).
4. Next to it write the value which you want to set which is by default 2 MB.
5. Close and save php.ini.
6. You may need to have an IIS reset to have the change reflected.
Note:- In Windows 2003, you will need to copy the original php.ini and paste the domain root for which you want to set the upload limit. And in Windows 2008/2008 R2, it works serverside.
In the same way we can also limit the ”maximum number of files that can be uploaded via a single request” for a PHP-based application. For this, please search “max_file_uploads” in php.ini instead of upload_max_filesize. By default this limit is 20.
]]>