Je kan makkelijk weten waar het fout gaat, door echo's/print's te plaatsen, zoals:
Code: Selecteer alles
<?php
echo "start-";
$file = "test.mp3";
if(file_exists($file) && is_file($file)) {
echo "it's a file+it exists-";
header("Cache-control: private");
header("Content-Type: application/octet-stream");
header("Content-Length: " . filesize($file));
header("Content-Disposition: filename=$file");
flush();
$fd = fopen($file, "r");
while(!feof($fd)) {
echo "it's not the end of the file yet-";
echo fread($fd, filesize($file));
flush();
}
echo "end of file-";
fclose ($fd);
echo "file closed-";
}
echo "done";
?>
Als er daarna niets te zien is, ondersteund je server/host geen PHP. Wees er overigens zeker van dat het liedje zich in dezelfde map bevindt, en dat je
$file = "test.mp3";
hebt aangepast.