I read that IE first read the headers fully ( including the file ) and then
ask it again for opening while Netscape read the file only once.
This description matches what I've seen. Here's what I've come up with that seems to work for IE and Netscape on Windows and Mac.
//$y is the full pathname of the file
...
$x = stat( "$y" );
header( "Accept-Ranges: bytes" );
header( "Content-Length: " . $x[7] );
header( "Connection: close" );
$a = basename( $y );
if( strpos($a,':') )
$a = substr( $a,0,strpos($a,':') );
if( strpos($y,'.') )
$z = substr( $y,strrpos($y,'.') ); // get suffix
else
$z = 0;
if( $z )
{
if( strpos($z,':') )
$z = substr( $z,1,strpos($z,':')-1 );
else
$z = substr( $z,1 );
header( "Content-Type: " . FindMime($z) ); // FindMime is my function
}
else
{
header( "Content-Type: application/octet-stream" );
}
readfile( "$y" );
exit;
--
Bill Rausch, Software Development, Unix, Mac, Windows
Numerical Applications, Inc. 509-943-0861 bill@numerical.com