ASP FileUpload file size issue

I am using a file upload control for my asp application and it throws HttpException when the file upload size is greater than the maximum request length.

As I understand it, fileupload will open a memory stream to a file after the file view dialog is closed, but there is no way to know when the dialog is closed so that I can decide whether to abort the download.

Does anyone know a way to examine the file size before starting the download?

Spam.

+1


source to share


3 answers


If you leave the file upload to the built-in Asp.Net mechanisms, the upload will fail if the request size is larger than the maximum size set in the web.config (or machine.config) file.



You can solve this by writing your own HttpHandler and check the request size first and then process the request data in your code.

+1


source


I doubt there is a one-size-fits-all way to check the file size on the client side (I mean for all browsers), since usually the client-side script doesn't have access to the filesystem.



I used to throw server side exceptions and then noticed a user while programming in classic ASP.

0


source


This control will allow you to upload any file size. I use it and it is very convenient. I believe there is a source if that's what you want.

http://www.brettle.com/neatupload

0


source







All Articles