in reply to how to get the sizes of a file when i use CGI.PM to upload it~~?

Maybe the file of uploaded file is stored in Content-Length: header, in CGI script you can get it via $ENV{CONTENT_LENGTH}.

--
Tatsuhiko Miyagawa
miyagawa@cpan.org

  • Comment on Re: how to get the sizes of a file when i use CGI.PM to upload it~~?
  • Download Code

Replies are listed 'Best First'.
Re: Re: how to get the sizes of a file when i use CGI.PM to upload it~~?
by Beatnik (Parson) on Jul 30, 2001 at 16:08 UTC
    Actually $ENV{CONTENT_LENGTH} contains more than just the file data. If you upload multiple files, or have other form fields, using $ENV{CONTENT_LENGTH} is way off. My guess would be either with length or with -s/stat.

    Update: Note that even tho you only send file data thru, the $ENV{CONTENT_LENGTH} still isn't the actual size of the file. Other data is send along, data which CGI novices don't need directly.

    Greetz
    Beatnik
    ... Quidquid perl dictum sit, altum viditur.