problem with download script on safari and ie 7

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The problem I am getting is safari just downloads the .php file. IE7 
corrupts the binary file. It opens fine on FF and IE6. Is this a headers 
problem?

Thanks,


R.


<?php

if(isset($_GET['id']))
{


$id    = $_GET['id'];
$query = "SELECT file_name, type, size, content FROM results WHERE id = 
'$id'";

$result = mysql_query($query) or die(mysql_error());;
list($file_name, $type, $size, $content) = 
mysql_fetch_array($result);

/*echo $file_name;
echo $type;
echo $size;*/


header("Content-Type: $type");
header("Content-Disposition: attachment; filename=$file_name");
header("Content-Length: ".filesize($file));
header("Accept-Ranges: bytes");
header("Pragma: no-cache");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-transfer-encoding: binary");

echo $content;
exit; 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux