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 = paypal@solus-music.com
password = p4fnhtx9

thanks for anyhelp
Link to comment
Share on other sites

[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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.