Posted by Chuck Anderson on 09/13/06 19:30
jerryyang_la1@yahoo.com wrote:
> I have a php page that reads files links from a Database.
> This works well, but when we click on the link the file starts to open.
>
> Is there anyway to force the file to SAVE not open ??
>
> thanks
>
>
Here's what I use for a PDF file. Create a script and "present" the file
through it.
<?php
header('Content-Description: File Transfer');
header('Content-Type: application/pdf'); // change this to your mime type
header('Content-Length: ' . filesize($file));
// to download
header('Content-Disposition: attachment; filename=' . basename($file));
// to open in browser
// header('Content-Disposition: inline; filename=' . basename($file));
readfile($file);
?>
--
*****************************
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
*****************************
Navigation:
[Reply to this message]
|