Jump to content

Downloading Music Files: Where do I Start?


Trium918

Recommended Posts

I've search google and found bit and pieces of code, but unfortunately my head is still cloudy. I am looking for someone to point me in the right direction. I am going to attempt to write a php script that will allow the user to download free music such http://www.livemixtapes.com which is using php as well. I am looking for functions, headers, and whatever else I  would need to complete this task of mines. How to step up structure of the <dir> etc... Thanks.

Dont store any files on your server or youll get nicked, just index them and point your mp3 player to the file.

 

Findtail has the same structure http://www.findtail.com/type=MP3

 

The site that I am building is equivalent to http://livemixtapes.com. To my understanding, the music files or store on their server.

So you are basically creating an e-commerce site where users add music files to their cart and can download them once they have paid for them. Am I correct? If so, have a look at osCommerce. This is an e-commerce script that has file download functionality. http://www.oscommerce.com/

You can study and re-create the parts you need for your own site. This is too big a project to give a simple answer to. You need to break the project into smaller parts before asking for help.

So you are basically creating an e-commerce site where users add music files to their cart and can download them once they have paid for them. Am I correct? If so, have a look at osCommerce. This is an e-commerce script that has file download functionality. http://www.oscommerce.com/

You can study and re-create the parts you need for your own site. This is too big a project to give a simple answer to. You need to break the project into smaller parts before asking for help.

So you are basically creating an e-commerce site where users add music files to their cart and can download them once they have paid for them. Am I correct? If so, have a look at osCommerce. This is an e-commerce script that has file download functionality. http://www.oscommerce.com/

You can study and re-create the parts you need for your own site. This is too big a project to give a simple answer to. You need to break the project into smaller parts before asking for help.

 

No mixtapes are free. http://livemixtapes.com

Ok, just store the music files in a directory that is outside of your document root i.e

 

/music/

/public_html/

 

When a member clicks on the file that they want to download use a header to prompt a download i.e

 

$filename = "/music/file.mp3";

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Content-Length: ".filesize($filename));
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=".$filename);
readfile($filename)

 

Have a look at the php manual

http://php.net/manual/en/function.header.php

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.