graceful file upload limit error?

B

bruce barker

no. the only way a webserver can stop an upload is to close the tcp
connection, as the protocol is so simple. IE just shows a generic message,
other browsers may be more informative.

-- bruce (sqlwork.com)
 
S

Shan Plourde

I have a series of .net file upload pages i've written that validate the
posted file size, before it is saved. Keep in mind that it is posted to
the server side and the server side is then validating the file
size...not the most efficient solution but it works. I can show you my
approach if that's specifically what you're looking for.
Shan
 
J

Joe Fallon

3rd party controls can do it (for a price).
Nothing built -in.

One trick is tell the user of the site that the limit is 6MB.
Then set your web.config file to 8MB.

Allow the file to be fully uploaded, then check its size and if it is
greater than 6MB send your friendly error message.
Obviously, you get the "standard" screen if the file is over 8MB.
But you get the idea.
 
T

Tom Kaminski [MVP]

Shan Plourde said:
I have a series of .net file upload pages i've written that validate the
posted file size, before it is saved. Keep in mind that it is posted to
the server side and the server side is then validating the file
size...not the most efficient solution but it works. I can show you my
approach if that's specifically what you're looking for.

Are you saying this will catch it before the maxRequestLength is reached?
So if the file is 10 MB and maxRequestLength is 5 MB, your code will display
an "error" message?
 
S

Shan Plourde

Sorry I misunderstood you. I have a similar design to what you have
right now. So I have the same issue that you have I would imagine.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top