Download file with Internet Explorer 7 and 8


Dear all,

The code below downloads the file in $file when used with all browsers, but it downloads a 0kb file when used with  Internet Explorer 7 and 8..

What do I have to add to the script to make it work for Internet Explorer 7 and 8 also??

Thanks a lot
<?php

$file ="http://www.turismosevilla.tv/player/1.flv";

header( 'Expires: Mon, 1 Apr 1974 05:00:00 GMT' );
header( 'Pragma: no-cache' );
header( 'Cache-Control: must-revalidate, post-check=0, pre-check=0' );
header( 'Content-Description: File Download' );
header( 'Content-Type: application/octet-stream' );
header( 'Content-Length: '.filesize( $file ) );
header( 'Content-Disposition: attachment; filename="'.basename( $file ).'"' );
header( 'Content-Transfer-Encoding: binary' );
readfile( $file );  
?>

Open in new window

Dada44Asked:
Who is Participating?
 
AnithaRajeshCommented:
Hi,

<?php

$file ="http://www.turismosevilla.tv/player/1.flv";

header( 'Expires: Mon, 1 Apr 1974 05:00:00 GMT' );
header( 'Pragma: no-cache' );
header( 'Cache-Control: must-revalidate, post-check=0, pre-check=0' );
header( 'Content-Description: File Download' );
header( 'Content-Type: video/flv' );
header( 'Content-Disposition: attachment; filename="'.basename( $file ).'"' );
readfile( $file );  
?>

Have removed content length & changed content type as  video/flv. It works in IE8 check it out in IE7
0
 
leakim971PluritechnicianCommented:
Hello Dada44,

Try example one here : http://www.php.net/manual/en/function.readfile.php

(replace by your $file)

Regards.
0
 
Dada44Author Commented:
thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.