Page 1 of 1

Having troubles naming my downloaded file with Header!!

Posted: Thu Mar 24, 2011 1:15 pm
by psychotomus
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));
 

Re: Having troubles naming my downloaded file with Header!!

Posted: Thu Mar 24, 2011 1:21 pm
by psychotomus
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)); 

Re: Having troubles naming my downloaded file with Header!!

Posted: Fri Mar 25, 2011 11:36 pm
by psychotomus
anybody?

Re: Having troubles naming my downloaded file with Header!!

Posted: Tue Mar 29, 2011 10:38 am
by psychotomus
Nobody? =) I still can't figure it out.. ;]