How to check the size of each files that are being uploaded

Discussion in 'Perl Misc' started by tower.grv@gmail.com, Sep 3, 2008.

  1. Guest

    Hello.
    I am developing cgi perl script for uploading files with uploading
    progress bar.
    Now i have script that do this good.
    While uploading i must to know total size of the file that is being
    uploaded.
    It is not problem becouse there is global variable
    $ENV{CONTENT_LENGTH} that contains the lenght of the attachment.

    The problem is when 2 or more files are bieng uploaded.

    How can i know the size of each file?
    I use CGI->new(\&hook) method to catch file uploading process.
     
    , Sep 3, 2008
    #1
    1. Advertising

  2. Guest

    "" <> wrote:
    > Hello.
    > I am developing cgi perl script for uploading files with uploading
    > progress bar.
    > Now i have script that do this good.


    How does it work? Does it use a separate frame for the monitoring?

    > While uploading i must to know total size of the file that is being
    > uploaded.
    > It is not problem becouse there is global variable
    > $ENV{CONTENT_LENGTH} that contains the lenght of the attachment.
    >
    > The problem is when 2 or more files are bieng uploaded.
    >
    > How can i know the size of each file?


    Strictly on the server, you can't. At least not until each file is done
    being sucked down by the server and the next "multipart/form-data" starts
    arriving.

    You might be able to craft some javascript running on the client side that
    will check on the local file size and encoded it into the form submission.

    But I don't see the point. As a user, I'd want to know when the upload is
    likely to be done. What do I gain by knowing what each individual
    component is doing?

    > I use CGI->new(\&hook) method to catch file uploading process.


    Xho

    --
    -------------------- http://NewsReader.Com/ --------------------
    The costs of publication of this article were defrayed in part by the
    payment of page charges. This article must therefore be hereby marked
    advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
    this fact.
     
    , Sep 3, 2008
    #2
    1. Advertising

  3. Guest

    > Partial solution is to use javascript to check file sizes before user click on
    > Send button. But be sure to warn users which have javascript disabled in
    > browser. It is very simple:
    >
    > <body>
    > <noscript>
    > <div style="border: 2px solid red">You have not javascript enabled, please
    > enable it.</div>
    > </noscript>
    > --

    I tried to get file size with javascrip but i found that it is
    imposiblem. Browsers don't allow this operation.
    Do you know how to do this?
     
    , Sep 4, 2008
    #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. rajesh

    Virus check files being uploaded.

    rajesh, Oct 29, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    466
    rajesh
    Oct 29, 2003
  2. Matt G
    Replies:
    1
    Views:
    1,201
    Deepak Kumar Vasudevan
    Aug 22, 2003
  3. rajesh

    virus check uploaded files.

    rajesh, Oct 29, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    362
    rajesh
    Oct 29, 2003
  4. h3m4n
    Replies:
    2
    Views:
    596
    h3m4n
    Jul 8, 2006
  5. Bryan
    Replies:
    3
    Views:
    145
    James Willmore
    Jan 15, 2004
Loading...

Share This Page