On Wed, 2008-01-02 at 12:38 -0500, Xiong, Bob wrote:
> Thanks, John. But I was looking for the Perl code. I also intended to allow a
> user to download the file and save it to his/her own computer (without opening
> it up). Sorry about not making myself clear. - Bob Xiong

The trick is to lie to the browser about the content-type.
E.g., for a PDF file if you use
        print $cgi->header('application/pdf");
then the browser knows it has PDF data, and will use the correct plugin
or helper application to display it.
On the other hand, if you claim
        print $cgi->header('application/octet-stream');
then the browser has no information about what plugin or helper app to
use, so will usually pop up the "select application or save file to
disk" dialog.  *This is browser-dependent.*  The browser can cheat and
look at file extensions, or the first few bytes of the file data.  But
it works most of the time.

--kag


 
_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to