ASP.NET File Upload Progress - Knowledge Base

« Back to Knowledge Base list

Reject a file before uploading


Is there a way for the component to reject a file before it goes through the business of uploading the file? In other words, I don't want clients to watch a 50MB file appear as though it is uploading for 15 minutes, and then get a rejection notification AFTER waiting because the file might be 51MB when the limit is set to 50.


Set the maximum size of HTTP request in Web .config:


  maxRequestLength is in KB (50MB here)





Add the following line to application settings of Web .config:


<add key="OboutInc.FileUpload.CancelOnServerException" value="True" />

Add the property
OnClientServerException to FileUploadProgress control to see the server exception’s message.