B
Braky Wacky
Hello,
I have an ASP.NET webpage that uses an instance of
System.Web.UI.HtmlControls.HtmlInputFile for uploading files to our
server. I came across the documentation at MSDN for upping the
filesize limit, once I saw the behavior of the page bombing with files
bigger than 4 MB. So far so good.
But the situation I'm coming across is that there doesn't seem to be
an elegant way of recovering from a user attempting to upload files
that are too big. I want a way to be able to handle this
programmatically, rather than dropping some custom error page in place
for HTTP 500 errors. The best I was able to come up with was to
actually set the httpRuntime maxRequestLength up to some ridiculously
high value, then check against the actual limit I want against the
PostedFile.ContentLength value in the event handler for the
HtmlInputFile. But it seems like the file actually gets uploaded
before I can check this value, completely defeating the purpose for
doing that in the first place.
Has anyone come up with a solution for managing the behavior of
attempting to upload files that are too large in ASP.NET? I'm at a
point where I'm thinking I'll need to develop an ActiveX control, or
leverage one from a third party, just to be able to manage this use
case.
Any thoughts/suggestions would be most welcome.
Thanks,
Kevin
I have an ASP.NET webpage that uses an instance of
System.Web.UI.HtmlControls.HtmlInputFile for uploading files to our
server. I came across the documentation at MSDN for upping the
filesize limit, once I saw the behavior of the page bombing with files
bigger than 4 MB. So far so good.
But the situation I'm coming across is that there doesn't seem to be
an elegant way of recovering from a user attempting to upload files
that are too big. I want a way to be able to handle this
programmatically, rather than dropping some custom error page in place
for HTTP 500 errors. The best I was able to come up with was to
actually set the httpRuntime maxRequestLength up to some ridiculously
high value, then check against the actual limit I want against the
PostedFile.ContentLength value in the event handler for the
HtmlInputFile. But it seems like the file actually gets uploaded
before I can check this value, completely defeating the purpose for
doing that in the first place.
Has anyone come up with a solution for managing the behavior of
attempting to upload files that are too large in ASP.NET? I'm at a
point where I'm thinking I'll need to develop an ActiveX control, or
leverage one from a third party, just to be able to manage this use
case.
Any thoughts/suggestions would be most welcome.
Thanks,
Kevin