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

    Hey!

    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!