Re: File Download NOT open
- From: Chuck Anderson <websiteaddress@xxxxxxxxx>
- Date: Wed, 13 Sep 2006 13:30:55 -0600
jerryyang_la1@xxxxxxxxx wrote:
I have a php page that reads files links from a Database.Here's what I use for a PDF file. Create a script and "present" the file through it.
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
<?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
*****************************
.
- References:
- File Download NOT open
- From: jerryyang_la1
- File Download NOT open
- Prev by Date: Exec and Redirecting Output
- Next by Date: Opinions on Zend Core for Oracle over PHP 5.1.4?!
- Previous by thread: Re: File Download NOT open
- Next by thread: losing STDIN
- Index(es):
Relevant Pages
|