Having troubles naming my downloaded file with Header!!
Posted: Thu Mar 24, 2011 1:15 pm
I am trying to name the file by the title with .mp3.. It only takes the first word of the title and doesn't even give it the file extension .mp3
Code: Select all
$fsize = filesize(cleanData($SEARCH->url));
header("Pragma: public"); // required
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false); // required for certain browsers
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=". cleanData($SEARCH->title). ".mp3;");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".$fsize);
ob_clean();
flush();
readfile(cleanData($SEARCH->url));