Hello,
I am using a php script that will download a file so that the file location will not be seen....
download.php?filename=something.mp3
since multilple files are located in multiple folders, i want to make something like this:
download.php?artist=something&album=something&song =song.mp3
the script will then extract what ever was set for the artist, album, and song and find the file according to the the folders that are named that.
here is what i have so far, but there is something wrong with it..instead, the actual download.php file downloads, not the mp3. please help.
PHP Code:
<?PHP
// File Download Script // by James Warkentin
// This script is provided without warrenty of any kind, nor may the author be held liable for // for any problems which arise as a result of the use of this script.
// Modify this line to indicate the location of the files you want people to be able to download // This path must not contain a trailing slash. ie. /temp/files/download
/* ###################################################################################*/ /* DO NOT MODIFY THE SCRIPT BEYOND THIS POINT */ /* ###################################################################################*/
$artist = $_GET['artist']; $album = $_GET['album']; $song = $_GET['song']; // Detect missing artist if(!$artist) die("I'm sorry, you must specify a file name to download.");
// Make sure we can't download files above the current directory location. if(eregi("\.\.", $song)) die("I'm sorry, you may not download that file."); $file = str_replace("..", "", $song);
// Make sure we can't download .ht control files. if(eregi("\.ht.+", $artist)) die("I'm sorry, you may not download that file.");
// Combine the download path and the artist to create the full path to the file. $file = "$download_path/$artist/$album/$song";
// Test to ensure that the file exists. if(!file_exists($file)) die("I'm sorry, the file doesn't seem to exist.");
// Extract the type of file which will be sent to the browser as a header $type = filetype($file);
// Get a date and timestamp $today = date("F j, Y, g:i a"); $time = time();
/* ###################################################################################*/
/* DO NOT MODIFY THE SCRIPT BEYOND THIS POINT */
/* ###################################################################################*/
$artist = $_GET['artist'];
$album = $_GET['album'];
$song = $_GET['song'];
// Detect missing artist
if(!$artist) die("I'm sorry, you must specify a file name to download.");
// Make sure we can't download files above the current directory location.
if(eregi("\.\.", $song)) die("I'm sorry, you may not download that file.");
$file = str_replace("..", "", $song);
// Make sure we can't download .ht control files.
if(eregi("\.ht.+", $artist)) die("I'm sorry, you may not download that file.");
// Combine the download path and the artist to create the full path to the file.
$file = "$download_path/$artist/$album/$song";
// Test to ensure that the file exists.
if(!file_exists($file)) die("I'm sorry, the file doesn't seem to exist.");
// Extract the type of file which will be sent to the browser as a header
$type = filetype($file);
// Get a date and timestamp
$today = date("F j, Y, g:i a");
$time = time();