Hello,
Can anyone verify / solve the problem I am having with downloading an
image..
The following test works fine in every browser I've tried except in mozilla
for windows. Mozilla appends .php to the file name when prompted to save or
open. In IE, I can save it to disk or open it, and the associated program
opens the file. In Mozilla, it can't open the file because it displays the
file like ... somefile.jpg.php
Any ideas why?
<?php
$fpath = "../tmp/";
$fname = "somefile.jpg";
header( "Pragma: no-cache\n" );
header( "Content-type: image/jpg\n" );
header( "Content-Disposition: attachment; filename=\"$fname\"\n" );
header( "Content-transfer-encoding: binary\n" );
header( "Content-length: " . filesize($fpath . $fname) . "\n" );
$fd = fopen($fpath . $fname, 'rb');
while( !feof($fd) )
{
echo fread($fd, 4096);
flush();
}
fclose( $fd );
?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php