Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

downloading an mp3 file through a Perl script

by keiusui (Monk)
on Feb 09, 2006 at 19:31 UTC ( #529168=perlquestion: print w/replies, xml ) Need Help??

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://529168]
Approved by kutsu
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2022-11-30 17:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?