Jump to content

Downloading mp3s using headers is taking forever?


spires

Recommended Posts

Hi

i'm trying to get a link that when clicked (not right clicked) will download a MP3 file.
I think i have it working, but when the file is downloading it takes forever then crashes.

Does this code look right to you.
[code]
$dir = '../cart/mp31/';
$file = $dir.$_REQUEST['userfile_name1'];


header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header('Content-length: '.filesize($file));
header("Content-Type: application/force-download");
header( "Content-Disposition: attachment; filename=".basename($file));

header( "Content-Description: File Transfer");
[/code]

goto:
www.nickyrubin.com/members
username = [email protected]
password = p4fnhtx9

thanks for anyhelp
[quote author=spires link=topic=104660.msg417596#msg417596 date=1155842498]
Just tryed it, it  only plays the track. It dont download it.
[/quote]
It downloads to the temp folder on your computer and plays it immediately with your default player. So technically you've "downloaded" it, just without the prompt. If you want to "force" download then use the php header method, and you need to print/echo the file to screen after the headers, so that user will get the data.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.