Upload file size

Discussion in 'ASP .Net' started by Lau Lei Cheong, Jun 23, 2004.

  1. 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

    --
    If you want to mail to me, please replace all instance of "e" to "a" in my
    email address. Thank you.
    Sorry for any inconvience caused, but I there's many spam-mailers.
    Lau Lei Cheong, Jun 23, 2004
    #1
    1. Advertising

  2. 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.

    "Lau Lei Cheong" <> wrote in message
    news:#d$...
    > 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
    >
    > --
    > If you want to mail to me, please replace all instance of "e" to "a" in my
    > email address. Thank you.
    > Sorry for any inconvience caused, but I there's many spam-mailers.
    >
    >
    >
    Kevin Spencer, Jun 23, 2004
    #2
    1. Advertising

  3. Lau Lei Cheong

    Joe Fallon Guest

    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.
    --
    Joe Fallon



    "Lau Lei Cheong" <> wrote in message
    news:%23d$...
    > 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
    >
    > --
    > If you want to mail to me, please replace all instance of "e" to "a" in my
    > email address. Thank you.
    > Sorry for any inconvience caused, but I there's many spam-mailers.
    >
    >
    >
    Joe Fallon, Jun 24, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. lawrence

    Upload file Check file size

    lawrence, Jun 10, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    9,279
    Craig Deelsnyder
    Jun 10, 2004
  2. Robert Strickland

    File Upload and File Size Limitations

    Robert Strickland, Oct 29, 2004, in forum: ASP .Net
    Replies:
    6
    Views:
    4,657
    Lau Lei Cheong
    Nov 1, 2004
  3. =?Utf-8?B?U2FyYXY=?=

    Upload a file without file Upload control - ASP.Net

    =?Utf-8?B?U2FyYXY=?=, Aug 2, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    2,432
    Bruce Barker
    Aug 3, 2005
  4. DJ Stunks
    Replies:
    1
    Views:
    178
    J. Gleixner
    Jan 23, 2006
  5. Replies:
    7
    Views:
    221
    Tad McClellan
    May 21, 2006
Loading...

Share This Page