Large File Http Post Upload - PHP and ASP.net
By default, PHP permits a maximum file upload of 2MB. So it's necessary to increase the limit when necessary.
Two PHP configuration options control the maximum upload size: upload_max_filesize and post_max_size. Both can be set to, say, "20M" for 20 megabyte file sizes.
However, you also need to consider the time it takes to complete an uploading. PHP scripts normally time-out after 30 seconds, but a 20MB file would take at least 5 minutes to upload on a healthy broadband connection. In addition, manipulating or saving an uploaded office file may also cause script time-outs. We therefore need to set PHP's max_input_time and max_execution_time to something like 300 (5 minutes specified in seconds).
These options can be set in your server's php.ini configuration file so that they apply to all your applications. Alternatively, if you're using Apache, you can configure the settings in your application's .htaccess file:
php_value upload_max_filesize 20M
php_value post_max_size 20M
php_value max_input_time 300
php_value max_execution_time 300
Finally, you can define the constraints within your PHP application:
Setting the options in your PHP code is possibly more practical, since you can extend the execution time and increase the file size when your application is expecting a large uploading.
For asp.net program, you need config the web.config.
The following attributes can be assigned to the <httpRuntime> tag in the <system.web> section of the Web.config file.
1. maxRequestLength : Specifies the limit for the input stream buffering threshold, in KB. This limit can be used to prevent denial of service attacks that are caused, for example, by users posting large files to the server. The default value is 4096 (4 MB). To enable large file uploads you need to change the value of this attribute to the largest allowed combined file size for your application. If someone selects and uploads files with total size larger than maxRequestLength, this will result in a "Page not found" error (which is the default error of the Framework).
2. executionTimeout : Specifies the maximum number of seconds that a request is allowed to execute before being automatically shut down by ASP.NET. The value of this setting is ignored in debug mode. The default in .NET Framework 2.0 is 110 seconds. In the .NET Framework 1.0 and 1.1, the default is 90 seconds.
To enable large file uploading, which can take long periods of time, increase the value of this property (executionTimeout).
For example: The configuration, allowing uploading of files up to 100MB and uploading periods up to 1 hour, should looks like the followings:
<httpRuntime maxRequestLength="102400" executionTimeout="3600" />
<compilation debug="true" targetFramework="4.0"/>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
<requestLimits maxAllowedContentLength="1024000000" />