PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
psychotomus
Forum Contributor
Posts: 487 Joined: Fri Jul 11, 2003 1:59 am
Post
by psychotomus » 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));
psychotomus
Forum Contributor
Posts: 487 Joined: Fri Jul 11, 2003 1:59 am
Post
by psychotomus » Thu Mar 24, 2011 1:21 pm
Problem fixed but now a new problem arises..
Script works perfect in FireFox. When using IE, it will not download the file. Its always 0kb... Any ideas?
Code: Select all
$SEARCH = mysql_fetch_object($s_query);
$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=" . str_replace(" ", "_",$SEARCH->title) . ".mp3;");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".$fsize);
ob_clean();
flush();
readfile(cleanData($SEARCH->url));
psychotomus
Forum Contributor
Posts: 487 Joined: Fri Jul 11, 2003 1:59 am
Post
by psychotomus » Tue Mar 29, 2011 10:38 am
Nobody? =) I still can't figure it out.. ;]