At 05:51 AM 07/10/2001 +0200, Evgeny Goldin (aka Genie) wrote:
>
> Hello,
>
> My goal is following : after user accesses http://host/script.pl ( either
> by direct link or by submitting the filled form ) I'd like to open a
> "Save as" dialog - to let him download a binary ( compressed ) file.
>
> 1) print header( "application/x-gzip" );
> open ( FIN, "TXTs.tar.gz" );
> binmode FIN;
> print <FIN>;
>
> works, but the file is going to be saved under "script.gz" name
instead of
> original "TXTs.tar.gz" - how can I specify the original name ?
Try setting a "Content-disposition: filename=filename.gz" http header.
Also, I've had better luck using the "application/octet-stream"
Content-type header instead. I have a "secure download" script which
basically streams binary data off the webserver root and allows the user to
download it. The headers I set look like this (where $fs is the filesize of
the data to be sent):
Content-Type: application/octet-stream
Accept-Ranges: bytes
Content-Length: $fs
Content-disposition: filename=downloaded.mp3
hth...aloha!
mel
____________________________________________________________
mel matsuoka Hawaiian Image Productions
Chief Executive Alphageek (vox)1.808.531.5474
[EMAIL PROTECTED] (fax)1.808.526.4040