Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

CGI header_props for Filesize?

by debiandude (Scribe)
on May 27, 2006 at 20:54 UTC ( #552041=perlquestion: print w/replies, xml ) Need Help??
debiandude has asked for the wisdom of the Perl Monks concerning the following question:

Hello everyone,

I have a section of my website that allows people to download a file. I don't want the file to display in the browser so I force it to be an attachment. Right now I set the following header properties:

-type => $types->mimeTypeOf($path), -attachment => $filename,

However, I noticed that when downloading from an non-internal machine (because on the local network it happens to fast for me to notice) that the file download/browser will say x bytes of unknown completed. Is there a way for me to specifc how my bytes in the file so that the browser will be able to calculate the estimated time.

I looked in the POD for CGI::Application but I didn't see anything.

Thanks in advance!

Replies are listed 'Best First'.
Re: CGI header_props for Filesize?
by rhesa (Vicar) on May 27, 2006 at 21:10 UTC
      Looks like you beat me too it! Thanks for the help though. I am going to check out that module you reccomened.
Re: CGI header_props for Filesize?
by debiandude (Scribe) on May 27, 2006 at 21:13 UTC


    I just checked out the W3's site for the definition of the HTTP/1.1 Header and found that the field that you need to set is 'Content lenght'.

    So just in case anyone later on in life if curious I needed to add this to my code:

    $self->header_props( { -type => $types->mimeTypeOf($path), -attachment => $filename, -Content_length => $fsize, } );
    Thanks all!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://552041]
Approved by Old_Gray_Bear
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2018-03-21 02:28 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (263 votes). Check out past polls.