Home > Archive > PERL CGI Beginners > November 2004 > Forcing download of compressed file
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Forcing download of compressed file
|
|
| Sean Davis 2004-11-23, 3:55 pm |
| I have a simple question:
I have a file that is a tar.gz file that I want download to the user
when a form is submitted. The file is static and I know how to set
headers, etc., for download. Is there a specific header type for
tar.gz files (so that the browser will try to uncompress, etc.)? How
do I need to print such a file so as to maintain the compressed format
(do I need to set to binary, etc.)?
Thanks,
Sean
| |
| Sean Davis 2004-11-23, 3:55 pm |
|
On Nov 23, 2004, at 1:37 PM, Korey Fort wrote:
> I know there is a way to do it using FTP. I can't remember how=20
> exactly, but I found some links that may help.
>
> =A0
>
> http://www.experts-exchange.com/Net...Q_20939305.html
>
> http://freebooks.by.ru/view/RedHatL...rhl6u074.htm=A0<----=20=
> This is it. This is from the book I have. Been a while since I read it=20=
> but here's the answer. So if you can put the file on an FTP server you=20=
> can make your job a whole lot easier, I guess! :-)
>
> Example of an /etc/ftpconversions Entry
>
> The following is a sample entry that compresses files using gzip on=20
> demand. This would allow someone who wants to get the file=20
> orb_discography.tar to instead request the file=20
> orb_discrography.tar.gz and have the server compress the file by using=20=
> gzip before sending it him. The configuration line that does this is=20=
[color=darkred]
> as follows:
> : : :.gz:/bin/gzip -9 -c %s:T_REG:O_COMPRESS:GZIP
>
>
>
>
> ----- Original Message -----
> From: "Sean Davis"
> To: "'beginners-cgi@perl.org' Lists"
> Subject: Forcing download of compressed file
> Date: Tue, 23 Nov 2004 08:11:08 -0500
>
> format
Korey,
Thanks for the reply. I would love to be able to put this behind an=20
"auth" site, either ftp or http. Then, I could just serve the link. =20
However, what I have is a CGI script that has its own authentication=20
and user maintenance, so I have to rely on it for authentication. =20
Therefore, I can't just serve up the file link (because people could=20
grab that link and download at will), but have to have the download be=20=
generated by the CGI if it is to remain (reasonably) secure. The file=20=
is already gzipped, so I don't need to do it on the fly. I am just=20
interested in how to print the gzipped file to the page and what is the=20=
most appropriate header to use to signal to the browser that the file=20
is a tar.gzip file. Any more insight?
Thanks,
Sean
| |
| Marek Kilimajer 2004-11-26, 3:55 pm |
| Sean Davis wrote:
> I have a simple question:
>
> I have a file that is a tar.gz file that I want download to the user
> when a form is submitted. The file is static and I know how to set
> headers, etc., for download. Is there a specific header type for tar.gz
> files (so that the browser will try to uncompress, etc.)? How do I need
> to print such a file so as to maintain the compressed format (do I need
> to set to binary, etc.)?
>
> Thanks,
> Sean
>
>
You can always find the correct content type by searching
apache-mime.types file
Binary transfer is only for FTP. HTTP has only one type.
|
|
|
|
|