header(\"Content-type: text/css\"); works in Firefox, Chrome and other, but not in Internet Explorer 9. I am not sure what\'s up.
In Chrome an
Recently I had a problem like this for myself too. Nasty debugging is all I can tell about this. Not sure if this might help you people, but I hope it will. Cut to the chase.
Internet Explorer uses something called Mime-type sniffing, which simply reads 200 Bytes of THE FILE header.
I had a PHP script which had to return different video file (with data - the whole file) dependent on the parameter it had been supplied with.
My video request example: get-video.php?id=here_goes_the_id
$file = ''; // Get the video file path
if (is_file($file)) {
header("Content-Type: video/mp4");
header("Content-Length: " . filesize($file));
readfile($file);
}
exit(); // This is the turnaround
You have to suspend your script immediately after it sends the file data. This prevents the IE Mime-type sniffing.
Hope it helps.