Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

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!

Comment on CGI header_props for Filesize?
Download Code
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!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://552041]
Approved by Old_Gray_Bear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2014-10-22 01:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (112 votes), past polls