Hey all, just a quick question for something with my site. I'm looking to have a download prompt pop up for mp3 files on a button release. I am under the impression that php is the only way to do this, but since I'm terrible with php, I'm stuck.
Here's the flash button script.
ActionScript Code:
on (release) {
lvOut = new LoadVars();
lvOut.file = "/" + _root.path + ".mp3";
lvOut.sendAndLoad("/dl.php", lvOut, "GET");
}
Where _root.path is something like "Artist - Title" in plane text, but it is the same as the file name.
And here's the php.
PHP Code:
header("HTTP/1.0 204 No Content");
$basedir = "http://www.mysite.com/workingfolder/";
header("Content-Type: octet/stream");
header("Content-Disposition: attachment; filename=\"".$_GET['file']."\"");
$fp = fopen($basedir.$_GET['file'], "r");
$data = fread($fp, filesize($basedir.$_GET['file']));
fclose($fp);
print $data;
Any help would be greatly appreciated.
Kevin