View Full Version : File upload size limit 10MB
pclcodesnet
08-10-2010, 11:55 PM
I read that you can override this to allow larger files by editing my application's web.config file.
How is this accomplished and does anyone have an examples or code?
Thanks, :)
Brad
Ramses
08-11-2010, 06:11 AM
There's a similar post which should answer your question:
http://community.discountasp.net/showthread.php?t=5831
Check it out and let us know if that doesn't work out for you.
pclcodesnet
08-11-2010, 12:48 PM
Now that I have it set where I want it how do I capture the "Maximum request length exceeded" errors and tell the user that their file is over the 20 MB limit?
lazycoder
09-27-2010, 09:04 AM
Unfortunately, when the request length exceeds the limit, your application isn't notified. Instead, IIS aborts the request.
The best you can do is to have the upload form in an iframe, then set up a javascript timer on container page which will periodically check for readyState=='complete' of the document in the iframe, and check the title of that document. If the upload worked, the document's title should be whatever you set it in TITLE tag of returned success page. If upload fails, the check of readyState throws an error or the title is wrong, depending on browser.
That javascript function may look something like this:
function monitor_upload() {
var error;
var iframe = document.getElementById('iframeID');
var doc = (iframe.contentDocument ? iframe.contentDocument : iframe.contentWindow.document)
try {
if (doc.readyState == 'complete' && iframe.title != 'Your Expected Title')
error = 1;
}
catch (err) {
error = 1;
}
if (error) {
alert("Maximum request length exceeded.");
}
else
setTimeout("monitor_upload()", 250);
}
then call monitor_upload(); when submit button is clicked.
Hope it helps.
vBulletin® ©Jelsoft Enterprises Ltd.