[nycphp-talk] Force download
Peter Sawczynec
ps at pswebcode.com
Tue Sep 12 14:48:30 EDT 2006
Try to box it in a bit more.
For example, will other file types download successfully.
[Typically, .zip files will always download properly.]
Try appropriately filled out inclusion of additional headers as suggested in
below sample:
$filename = "MAQ09718.MP4";
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
header("Content-Type: application/force-download");
header("Content-Disposition: attachment;
filename=\"".basename($filename)."\";" );
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($filename));
Google "force file download issues php" to find more headers you may need.
Call directly to and/or surf manufacturer's site for known issues / browser
version issues.
Warmest regards,
Peter Sawczynec,
Technology Director
PSWebcode
_Design & Interface
_Ecommerce
_Database Management
ps at pswebcode.com
646.316.3678
www.pswebcode.com
-----Original Message-----
From: talk-bounces at lists.nyphp.org [mailto:talk-bounces at lists.nyphp.org] On
Behalf Of Nathan Lavertue
Sent: Tuesday, September 12, 2006 2:29 PM
To: NYPHP Talk
Subject: [nycphp-talk] Force download
Any reason why the following script wouldn't force download the file in
question with the appropiate name in all situations? Works in a few
browsers, but, not while using the Internet Browser on the PSP. Tries to
save the file 'download.php' instead of the actual video file.
Thanks
<?
header("Pragma: no-cache");
header("Expires: 0");
header('Content-Description: File Transfer');
header('Content-type: application/force-download');
$filename = "MAQ09718.MP4";
header("Content-Disposition: attachment;
filename=\"".basename($filename)."\";" );
header("Content-Length: " . filesize($filename));
readfile($filename);
exit();
?>
Nathan Lavertue
Lead Designer & Developer - New Formats
Sony Music Studios - X Media Group
On Sep 11, 2006, at 11:53 AM, Aaron Deutsch wrote:
Has anyone used the pear LiveUser auth classes? Are they worth the hassle
of setting up and trying (also still in beta) or is there a better/easier
user login management tool available.
thanks,
aaron d.
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk
NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com
Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20060912/daa43cdf/attachment.html>
More information about the talk
mailing list