Hi,
I'm trying to create a basic download manager. I want to be able to upload files and then as you upload them they are added to a mysql database aswell, that includes the filename and the extension (that part im fine with.)
Then I want to allow people to download the files, without revealing the filename (to prevent leeching) I.e each file is downloaded with a set filename, although with the relevant extension.
I have this code which I think works for .midi files:
$filepath = 'http://mysiteaddress.com/' . $row['file_name'] . '.' . $row['extension'];
header('Content-Disposition: attachment; filename="' . $filepath . '"');
header('Content-Type: x-music/x-midi');
readfile($filepath);
header('Connection: close');
exit();
Then..
for au files: header('Content-Type: audio/basic');
for mp3's: header('Content-Type: audio/mp3');
for wavs: header('Content-Type: audio/x-wav');
My question is this. Is this the best way about doing what I plan to do? and further what headers should I use for .zip files, jpegs and gifs.
Also, if I included the size of the file in the database how could i include this in the download code I wrote above.
ANY help will be most appreciated.
Thanks.