Go Back   Dynamic Drive Forums > General Coding > Accessibility [CLOSED]
Search Dynamic Drive Forums:

 
 
Thread Tools Search this Thread
  #1  
Old 03-21-2006, 01:39 PM
kode kode is offline
Junior Coders
 
Join Date: Mar 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy Force Download with .htaccess

Please help!!

I've been trying to find a way of force downloading mp3's for an internet radio website and stumbled accross the .htaccess method using:

<Files *.mp3>
ForceType application/octet-stream
Header set Content-Disposition attachment
</Files>

or simply

AddType application/octet-stream mp3

Both seem to work fine for most mp3's but for some strange reason not all of them. I had tried renaming the files that dont work with names that do, to no avail and it is not size dependand as some of the files that don't work are smaller than ones that do. As far as I can tell there is no difference between the files that do and do not work and are all in the same folder.

Any ideas anyone....
  #2  
Old 03-21-2006, 03:55 PM
Twey's Avatar
Twey Twey is offline
Modtoreador
 
Join Date: Jun 2005
Location: 英国
Posts: 11,933
Thanks: 1
Thanked 180 Times in 172 Posts
Blog Entries: 2
Default

You're probably using IE. IE attempts to second-guess the server as to the downloaded file's MIME-type. There is, unfortunately, nothing that can be done about this.
__________________
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
  #3  
Old 03-21-2006, 04:07 PM
kode kode is offline
Junior Coders
 
Join Date: Mar 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

What about using Javascript to force download the file? I've seen examples of this on forums but looks more complicated than the .htaccess method.
  #4  
Old 03-21-2006, 04:21 PM
Twey's Avatar
Twey Twey is offline
Modtoreador
 
Join Date: Jun 2005
Location: 英国
Posts: 11,933
Thanks: 1
Thanked 180 Times in 172 Posts
Blog Entries: 2
Default

Not possible, I'm afraid.
Your best bet is to compress it somehow (gzip, bzip2, zip).
__________________
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
  #5  
Old 03-27-2006, 02:13 AM
djr33's Avatar
djr33 djr33 is offline
Global Moderator
 
Join Date: Mar 2006
Location: N. California, USA
Posts: 6,408
Thanks: 11
Thanked 82 Times in 82 Posts
Default

so... downloading as opposed to streaming?

Isn't there some way to make it automatically download?
Not FORCED download... as in they can still type in the url into the address bar, but it would make it default to downloading.
  #6  
Old 03-27-2006, 06:39 AM
Twey's Avatar
Twey Twey is offline
Modtoreador
 
Join Date: Jun 2005
Location: 英国
Posts: 11,933
Thanks: 1
Thanked 180 Times in 172 Posts
Blog Entries: 2
Default

As I said: compress it.
__________________
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!
  #7  
Old 03-27-2006, 07:20 AM
djr33's Avatar
djr33 djr33 is offline
Global Moderator
 
Join Date: Mar 2006
Location: N. California, USA
Posts: 6,408
Thanks: 11
Thanked 82 Times in 82 Posts
Default

Sure.

No, I just meant making it open as a download as opposed to a link you can just click and go to. Not sure how to do it... gmail does it with certain filetypes... there's some way, but might be incredibly complex CGI or something, or something more than that.

That'll work, though. Yep.
  #8  
Old 03-27-2006, 10:51 AM
kode kode is offline
Junior Coders
 
Join Date: Mar 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hmmm, interesting. Care to elaborate?
  #9  
Old 03-27-2006, 11:09 AM
mwinter mwinter is offline
Elite Coders
 
Join Date: Dec 2004
Location: UK
Posts: 2,361
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by djr33
No, I just meant making it open as a download as opposed to a link you can just click and go to. Not sure how to do it... gmail does it with certain filetypes... there's some way, but might be incredibly complex CGI or something, or something more than that.
No, what the OP originally posted is about the best that can be done from the server.

If IE didn't have a complete disregard for the requirements of RFC 2616 (that is, HTTP/1.1), this wouldn't be an issue (and this is the biggest stumbling block). Simply presenting an application/octet-stream Content-Type header value would produce the download prompt. Allowing the user to configure content handling, like Opera and Firefox permit, would result in an even better solution: send an accurate Content-Type header value and act based on user preferences.


I'm afraid there isn't really what you'd consider an adequate solution; trying to force anything on the Web is often a non-starter. Suggestions are about as much as you can hope for, and poor software, like IE, will always limit your options.

Mike
  #10  
Old 03-27-2006, 11:23 AM
kode kode is offline
Junior Coders
 
Join Date: Mar 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I would be happy if I could at least get a dialogue asking the user what they would like to do with the file. There are some instances when you would prefer to stream large mp3's for instance if you just wanted to check out the music without waiting to download but the standard version of Quick Time does not allow you to save the file once it is downloaded.

Any suggestions on how to achieve this?
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:23 AM.

Home - Contact Us - Archives - Link to DD - Top 

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.