Upload File Size

Discussion in 'ASP .Net' started by =?Utf-8?B?YXNpdmE=?=, Oct 18, 2006.

  1. I am using <INPUT id="File1" type="file" name="File1" runat="server"> to
    upload file to the server.

    My Questions:
    1. Is it possible to check the file size before the file is uploaded other
    than using
    Scripting.FileSystemObject ?

    2. If answer to 1 is no, is it possible to check in the server side the
    Request.ContentLength and prevent the exception/ blank page if the file size
    exceeds the value in <httpRuntime maxRequestLength="4000" />. Ie Stop the
    http request and show the previous page. I do not want to refresh the page as
    there may be some data in the submitted page which should not be cleared.

    3. If answer to 2 is no. I can set a very large value in <httpRuntime
    maxRequestLength="400000000" />. If the contentlength is large is there a way
    in the server side to stop the upload and show the user submitted page with
    an error message.

    --
    Thanks
    asiva
     
    =?Utf-8?B?YXNpdmE=?=, Oct 18, 2006
    #1
    1. Advertising

  2. =?Utf-8?B?YXNpdmE=?=

    Siva M Guest

    1. File size cannot be checked on the client-side as there is no way to
    access the local file system from a web page

    2 & 3: Information about the file uploaded in only available after the
    complete file content has been uploaded and hence upload cannot be stopped
    in the middle.

    "asiva" <> wrote in message
    news:...

    I am using <INPUT id="File1" type="file" name="File1" runat="server"> to
    upload file to the server.

    My Questions:
    1. Is it possible to check the file size before the file is uploaded other
    than using
    Scripting.FileSystemObject ?

    2. If answer to 1 is no, is it possible to check in the server side the
    Request.ContentLength and prevent the exception/ blank page if the file size
    exceeds the value in <httpRuntime maxRequestLength="4000" />. Ie Stop the
    http request and show the previous page. I do not want to refresh the page
    as
    there may be some data in the submitted page which should not be cleared.

    3. If answer to 2 is no. I can set a very large value in <httpRuntime
    maxRequestLength="400000000" />. If the contentlength is large is there a
    way
    in the server side to stop the upload and show the user submitted page with
    an error message.

    --
    Thanks
    asiva
     
    Siva M, Oct 18, 2006
    #2
    1. Advertising

  3. Due to security restrictions the only way to provide a rich upload
    experience like you describe is for the user to install a rich client of
    some kind that can access the file system, such as an ActiveX control or a
    windows forms app or control of some kind that has the necessary
    permissions.

    --
    I hope this helps,
    Steve C. Orr
    MCSD, MVP, CSM
    http://SteveOrr.net


    "asiva" <> wrote in message
    news:...
    >
    > I am using <INPUT id="File1" type="file" name="File1" runat="server"> to
    > upload file to the server.
    >
    > My Questions:
    > 1. Is it possible to check the file size before the file is uploaded other
    > than using
    > Scripting.FileSystemObject ?
    >
    > 2. If answer to 1 is no, is it possible to check in the server side the
    > Request.ContentLength and prevent the exception/ blank page if the file
    > size
    > exceeds the value in <httpRuntime maxRequestLength="4000" />. Ie Stop
    > the
    > http request and show the previous page. I do not want to refresh the page
    > as
    > there may be some data in the submitted page which should not be cleared.
    >
    > 3. If answer to 2 is no. I can set a very large value in <httpRuntime
    > maxRequestLength="400000000" />. If the contentlength is large is there a
    > way
    > in the server side to stop the upload and show the user submitted page
    > with
    > an error message.
    >
    > --
    > Thanks
    > asiva
     
    Steve C. Orr [MVP, MCSD], Oct 19, 2006
    #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,323
    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,714
    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,592
    Bruce Barker
    Aug 3, 2005
  4. DJ Stunks
    Replies:
    1
    Views:
    194
    J. Gleixner
    Jan 23, 2006
  5. Replies:
    7
    Views:
    244
    Tad McClellan
    May 21, 2006
Loading...

Share This Page