Restrictions of FileUpload control
The FileUpload control from ASP.Net has several limitations. The most common limitation is regarding the filesize. By default, files of upto 4MB can be uploaded without any problems. Beyond that, ASP.Net will reject the request. To allow files of upto 2GB to be uploaded, you can change the httpRunTime in web.config as follows:
<system.web><httpRunTime maxRequestLength="2000000" executionTimeOut="999999" /></system.web>The maxRequestLength is specified in KB. A size of 2,000,000 will allow almost a 2GB file to be uploaded. Also, the timeout to complete the request should be set high so that upload can happen. If maxRequestLength is exceeded in a request, then the request is abruptly declined and control is returned back to the browser. This error cannot be trapped within the AsP.Net framework because - the page is not loaded, no exception is raised, no HttpModule is called, the request abruptly terminates and browser receives no status code.
The other limitation is that it is not possible for the upload control to determine the size of the file before the upload. This means that it is not possible to restrict the upload of files based on file size. I cannot set a javascript rule that files beyond 100KB cannot be uploaded
Apart from large files upload, the upload control has other problems. It is not possible to set a filter-type of which files to upload. For eg, if you want to upload only image files, it is not possible to set a filter - .jpg | .gif | .bmp to the upload control so that only files of these types are shown.
The FileUpload control does not have a progress bar to indicate the progress of the upload. If your website allows users to upload files regularly, then it is better to go for a custom FileUpload control based on JQuery or Silverlight
Category : ASP.NET


