file size OT

Discussion in 'HTML' started by Jeff Thies, Feb 10, 2004.

  1. Jeff Thies

    Jeff Thies Guest

    I have a "demand" for a file upload progress bar.

    I've figured out how to return the number of bytes uploaded/saved back to
    the browser. What I haven't figured out is how to read the file's size,
    either client or server side (perl), so I can calculate a percentage.

    I would have thought this was embedded in the file somewhere, as well as
    it's content type. I can't find it, do I have this wrong?

    I'm terribly sorry for asking this question here, I'm a bit desperate for
    an answer and I know someone here knows the answer. I haven't found it
    elsewhere.

    Jeff
     
    Jeff Thies, Feb 10, 2004
    #1
    1. Advertising

  2. Jeff Thies

    Joe Smith Guest

    Jeff Thies wrote:

    > I've figured out how to return the number of bytes uploaded/saved back to
    > the browser. What I haven't figured out is how to read the file's size,
    > either client or server side (perl), so I can calculate a percentage.


    The size of the file on the server is
    $size = -s $file;

    The size of the file on the client is not available.
    With a multi-file POST, the Content-length does not give any indication
    as to the current file's size.

    Upload progress bars should be implemented on the client's browser,
    not the server.
    -Joe
     
    Joe Smith, Feb 10, 2004
    #2
    1. Advertising

  3. Jeff Thies

    Jeff Thies Guest

    > > I've figured out how to return the number of bytes uploaded/saved back
    to
    > > the browser. What I haven't figured out is how to read the file's size,
    > > either client or server side (perl), so I can calculate a percentage.

    >
    > The size of the file on the server is
    > $size = -s $file;


    That looks like the file size is not available until after the file has been
    saved.
    Is that right?

    Jeff

    >
    > The size of the file on the client is not available.
    > With a multi-file POST, the Content-length does not give any indication
    > as to the current file's size.
    >
    > Upload progress bars should be implemented on the client's browser,
    > not the server.
    > -Joe
     
    Jeff Thies, Feb 10, 2004
    #3
  4. Jeff Thies

    Joe Smith Guest

    Jeff Thies wrote:

    >>>I've figured out how to return the number of bytes uploaded/saved back

    >
    > to
    >
    >>>the browser. What I haven't figured out is how to read the file's size,
    >>>either client or server side (perl), so I can calculate a percentage.

    >>
    >>The size of the file on the server is
    >> $size = -s $file;

    >
    >
    > That looks like the file size is not available until after the file has been
    > saved.
    > Is that right?


    Depends on the OS and the module used for uploads.

    Unix-like OSes let you see the size of the file while it is being
    written, others show zero bytes until the file is closed.
    CGI.pm provides access to the file after it has been completely
    uploaded; for do-it-yourself solutions you can count the number
    of decoded bytes that you are writing to the file.
    -Joe
     
    Joe Smith, Feb 10, 2004
    #4
    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. tiewknvc9
    Replies:
    6
    Views:
    661
    Chris Uppal
    Oct 1, 2006
  2. Jason Cavett

    Preferred Size, Minimum Size, Size

    Jason Cavett, May 23, 2008, in forum: Java
    Replies:
    5
    Views:
    12,583
    Michael Jung
    May 25, 2008
  3. Keith Thompson

    Re: File Size - Big File Size

    Keith Thompson, Oct 1, 2009, in forum: C Programming
    Replies:
    6
    Views:
    294
    Phil Carmody
    Oct 3, 2009
  4. Michael Tsang

    Re: File Size - Big File Size

    Michael Tsang, Oct 4, 2009, in forum: C Programming
    Replies:
    2
    Views:
    323
    Keith Thompson
    Oct 4, 2009
  5. Nobody

    Re: File Size - Big File Size

    Nobody, Oct 5, 2009, in forum: C Programming
    Replies:
    10
    Views:
    2,034
    Flash Gordon
    Oct 10, 2009
Loading...

Share This Page