apache - Stop mp3 file from streaming in browsers -
I have an MP3 on an Apache server, I want it to be downloaded as a file, when a user links Visit Instead, Quicktime, or Google Chrome Media Player, will try and stream it.
Is there a fix with this for header? Or the only option is to 'save as a right click save'?
Edit Here is my header Safari has stopped streaming, but Chrome content is done to do this. It seems that Chrome is not being taken into account:
I can see that the header has been altered properly:
Date Wed, 04 Aug 2010 00:14:35 GMT Server Apache / 2.2.13 (Unix) mod_ssl / 2.2.13 OpenSSL / 0.9.8 E-Phipps-RHL5 mod_auth_passthrough / 2.1 mod_bwlimited / 1.4 FrontPage / 5.0.2.2635 PHP / 5.2.11 Last Modified Mars , 03 Aug 2010 04:37:01 GMT Etag "2bbd692-79597d-48ce3de3f5540" Accept Bytes Content-Length 7952765 Keep Content-Attachment Attachment -Elive Timeout = 5, Max = 100 Connects Not Keep-Alive Content-type audio / mpeg
What is something in the header may be the reason?
Edit I did this by doing some research: It seems that there might be a bug in preventing Chrome from downloading it.
You want to set the response header for "attachment", and maybe even the "filename" field.
Example:
Content: Attachments; File name = foo.mp3;
To complete it directly in Apache, try putting in your httpd.conf
or .htaccess
file:
& lt; File match ". (? I: MP3) $" & gt; Forcetepe Audio / MPEG Set Env IF Request_URI "^. * /? ([^ /] *) $" FILENAME = $ 1 Header Set Content Disposition "Attachment; Filename =% {FILENAME} and" UnsetNew FILENAME "& lt; / FilesMatch & gt;
Edit:
Apache configuration was taken from the file name field for example, however, though non- Because of the filenames with US-ASCII characters, you should know about potential problems: see.
Alternatively, you can use a normal static filename (because you already know the extension), song.mp3
, but it depends on your circumstances May not be an option.
The third option will be to create a script to complete these MP3s, which can set the header and
Comments
Post a Comment