http://www.perlmonks.org?node_id=265243


in reply to Re: Non-Duplicate File Names, Security, and Self Cleaning
in thread Non-Duplicate File Names, Security, and Self Cleaning

I've switched from Archive::Zip to Archive::Tar, so there's not a writeToFileHandle() method available. Where I'm running into trouble now is getting the file to the browser. CGI::Push isn't what I want to do, and
# Send the .tar file to the browser print $q->redirect( $filename );
can't do it. I could do
print $q -> start_html, $q -> a ( "$filename", $filename ), $q -> end_html;
but if I could avoid the whole new page thing I'd like to. Any ideas?
Cheers!
-P
Don't worry about people stealing your ideas. If your ideas are any good, you'll have to ram them down people's throats.

-Howard Aiken

Replies are listed 'Best First'.
Re: Re: Re: Non-Duplicate File Names, Security, and Self Cleaning
by benn (Vicar) on Jun 13, 2003 at 16:00 UTC
      Actually I've figured out how to send the file. Now I'm trying to figure out how multi-part file headers work so I can send the file and make a just-in-case "Click here if the file does not start downloading automatically" page all from one script. Thanks for the link
      Cheers!
      Petras
      Don't worry about people stealing your ideas. If your ideas are any good, you'll have to ram them down people's throats.

      -Howard Aiken
        <html> <head> <META HTTP-EQUIV="refresh" CONTENT="0;url=Other_File.tar"> </head> <body> Downloading... </body> </html>

        How it works:

        The HTML page is rendered by the browser, then the "refresh" immediately expires. The browser will then download and try to render the .tar file. Since it can't render it, the browser will ask if you want to save the file. And the HTML page will still be there.

        This technique will not work for jpeg, gif, or text files, because any browser can render those formats!