Upload file size

  • Thread starter Thread starter Lau Lei Cheong
  • Start date Start date
L

Lau Lei Cheong

Hello,

Is there a way to determine the size of a file in InputFile control
before it starts uploading(i.e.: wants to determine the file size at
client-side)?

The checking cannot be done on server-side because we'll have to wait
the HttpRequest stream transfer complete before the program starts to run.
We cannot limit the filesize by setting maxRequestLength because there'll be
more than one upload at a time. We've tried to add a hidden control with
name="MAX_FILE_SIZE" immediately after the form tag and found it not
working(at least in IE6SP1 I'm using, do I need to add one for each upload
control?)

I know that there's a method which use javascript to open the file and
gather the filesize information before it starts to upload, but since I do
not have the digitial certificate to sign the script, this is not possible
for me.

Is there such way without signing codes works? Thanks a lot.

Regards,
Lau Lei Cheong
 
It must be done on the client. Therefore, you will need a client-side app
(JavaScript, Java Applet, ActiveX Control, etc) to do the work.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
There is no built-in way to do this.
There is a very long thread out there somewhere which discusses this issue
in detail.
It lasted for about a year.
As I recall, they posted 90% of the code required to do this and then sold
it to a 3rd party company.
So now you can buy the functionality (it isn't free)

It involved writing an HTTP Handler (I think).
Then you gain complete control over the request and can check file size and
use progress bars.
 
Back
Top