Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Upload file Check file size

Reply
Thread Tools

Upload file Check file size

 
 
lawrence
Guest
Posts: n/a
 
      06-10-2004
Using <INPUT type"file" runat="server"> to upload a file. When the
file size is too large I get a "page cannot be display" error. Thats
cool I'm down with that. But is there a way to check for file size
(client or server side), so that error doesn't occur?

Thanks
--Dietrich
 
Reply With Quote
 
 
 
 
George Ter-Saakov
Guest
Posts: n/a
 
      06-10-2004
Not that i am aware.
The file size upload is a server restriction and you can change it.
Also i think that error is one of the standard error pages from IIS server.
So you can modify it.

George.

"lawrence" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> Using <INPUT type"file" runat="server"> to upload a file. When the
> file size is too large I get a "page cannot be display" error. Thats
> cool I'm down with that. But is there a way to check for file size
> (client or server side), so that error doesn't occur?
>
> Thanks
> --Dietrich



 
Reply With Quote
 
 
 
 
Craig Deelsnyder
Guest
Posts: n/a
 
      06-10-2004
On Thu, 10 Jun 2004 13:39:31 -0400, George Ter-Saakov <(E-Mail Removed)>
wrote:

> Not that i am aware.
> The file size upload is a server restriction and you can change it.
> Also i think that error is one of the standard error pages from IIS
> server.
> So you can modify it.
>
> George.
>
> "lawrence" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) om...
>> Using <INPUT type"file" runat="server"> to upload a file. When the
>> file size is too large I get a "page cannot be display" error. Thats
>> cool I'm down with that. But is there a way to check for file size
>> (client or server side), so that error doesn't occur?
>>
>> Thanks
>> --Dietrich

>
>


Yes, you can change it to a larger number:

http://www.tek-tips.com/gfaqs.cfm/pid/855/fid/3217

please excuse the annoying flyover ad on that page

I also agree, I don't know of any JS that can detect that, unless it had
extremely lax browser privileges, which is a very rare setup you'd have to
make sure is there (change client's browser settings). I don't know if
you can somehow create an HttpModule to intercept the incoming file before
the server check is done by ASP.NET (note this is not IIS throwing the
error, but ASP.NET as it's an ASP.NET setting).

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
 
Reply With Quote
 
dietrich
Guest
Posts: n/a
 
      06-10-2004
ASP.NET throws the error? What is actually happening. Is some sort of
header with file size info being read, or is the file being streamed,
and then chokes at the set limit?


*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
Craig Deelsnyder
Guest
Posts: n/a
 
      06-10-2004
On Thu, 10 Jun 2004 12:16:34 -0700, dietrich <(E-Mail Removed)> wrote:

> ASP.NET throws the error? What is actually happening. Is some sort of
> header with file size info being read, or is the file being streamed,
> and then chokes at the set limit?
>
>
> *** Sent via Devdex http://www.devdex.com ***
> Don't just participate in USENET...get rewarded for it!


Well, if you follow that link, you'll notice that it's a setting you can
put in web.config, which is ASP.NET specific. It was introduced to
prevent malicious uploading or be able to conserve your bandwidth (enforce
file sizes).

It is possible IIS has a limit of its own, and maybe something you can set
also, which would be checked first. I can't remember tho, when you see
this error page, if it's a result of IIS giving the error, or ASP.NET
playing dumb and returning a 500....

I'm not familiar with all the internals of exactly what goes on in this
scenario. The times I've hit it, it hit the ASP.NET limit and errored
out, so I was able to up the size and get it to go through.

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Preferred Size, Minimum Size, Size Jason Cavett Java 5 05-25-2008 08:32 AM
File upload from client application (non-form based upload) stuart@microsoft.com Python 1 11-25-2006 12:14 AM
mega pixels, file size, image size, and print size - Adobe Evangelists Frank ess Digital Photography 0 11-14-2006 05:08 PM
Upload a file without file Upload control - ASP.Net =?Utf-8?B?U2FyYXY=?= ASP .Net 3 08-03-2005 01:09 AM
How to detect sizeof upload in order to show status of browser file upload? Heather Fraser Java 0 07-05-2004 12:35 AM



Advertisments