I did this PHP script
$file_name = \'sample.mp3\'; header(\'Content-Type: audio/mpeg\'); $opts = array(\'http\' => array
This should hopefully fix your problem, follow this method.
What you need to do is use readfile()
and set file_exists()
so that you can tell you're opening the correct file.
$extension = "mp3";
$mime_type = "audio/mpeg, audio/x-mpeg, audio/x-mpeg-3, audio/mpeg3";
if(file_exists($file_name)){
header('Content-type: ' . $mime_type);
header('Content-length: ' . filesize($file_name));
header('Content-Disposition: filename="' . $file_name);
header('X-Pad: avoid browser bug');
header('Cache-Control: no-cache');
readfile($file_name);
}
Reference