http://qs321.pair.com?node_id=529168

keiusui has asked for the wisdom of the Perl Monks concerning the following question:

I want people to be able to download an mp3 file without knowing the actual location of the mp3 file. Therefore I have written the following script which works perfectly in Internet Explorer:

print "Content-type: audio/mp3\n"; print "Content-Disposition: attachment; filename=mypersonalrecording.m +p3\n\n"; open SONG, "/location/to/mypersonalrecording.mp3"; while(read SONG, $download, 16384, 0){print $download;} close SONG;

Would it be better to write print "Content-type: application/x-download\n"; in the header instead?

Replies are listed 'Best First'.
Re: downloading an mp3 file through a Perl script
by vladb (Vicar) on Feb 09, 2006 at 19:42 UTC
    Try adding mp3 content type header:
    Content-type: audio/mp3
    
    It is likely that some of your users' IE browser would default to a document type unless one is explicitly specified.
    Update: didn't realize you half answered your own question there, heh!
    


    _____________________
    "We've all heard that a million monkeys banging on a million typewriters will eventually reproduce
    the entire works of Shakespeare. Now, thanks to the Internet, we know this is not true."

    Robert Wilensky, University of California