i am going crazy here. i am trying to create two options in my new web site:
1) Play a file
2) Download a file
at least 2) should go through php script (so i can track nr. of downloads). option 1 - play a file works well, i just redirect to the file URL using Header("Location: .....mid"); music starts to play automatically at least on my machine. works well in IE and in Firefox.
2) - DOWNLOAD - the idea was that user clicks a file and php pushes that file to the browser. this works well in Firefox but in IE... download works fine but i noticed another problem. when IE tries to initiate download it asks you what to do with a file:
if i press Save a file - works. even if I press Open once the download is finished, i hear MIDI playing.
but if i select Open right after i clicked the link, Windows media player starts and reports that it is unable to play the file. i guess i must be doing something wrong when pushing headers to browser. any ideas? here is how i did it (and i tried 100 options already 😕
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header('Content-Type: $xContent_type');
header('Content-Disposition: attachment; filename="' . basename($dFilename) . '"');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
@readfile($xFull_path);