Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Prevent 'garbled text' file downloads via server settings OS X Server
I've been trying for quite some time to fix this problem one software vendor at a time, but then thought the Mac OS X Hints would probably be a good way to get the attention of many software developers all at once.

The problem: When I download a .dmg file from someone's web site, about 25% of the time my browser loads the binary file as text to a window instead of saving the file to disk. The reason this happens is that their web server is not configured properly. The problem has persisted for a long time because the two biggest Mac browser (Safari and IE) disregard the server settings and download the file anyway. You may have experienced a similar problem (even with Safari or IE) when downloading .gz or .sitx files.

So, if you manage a web site, please add the following to your site's .htaccess or httpd.conf file:

AddType  application/octet-stream      .dmg
AddType  application/x-gzip            .gz
AddType  application/x-stuffit         .sit
AddType  application/x-stuffit         .sitx
AddType  application/zip               .zip
The other way to fix it is to change your server's default type, which would mean all unknown file types would be downloaded (and wouldn't that make a whole lot of sense?).

DefaultType        application/octet-stream
Applying one of these fixes avoids the annoying occurrence of having your users' browsers get hung for 5 minutes while they try to render 20MB of binary data as text (and would thus help to improve the overall Mac experience)!

[robg adds: I've put this in the OS X Server category, but it obviously applies to anyone running a server on any platform...]
    •    
  • Currently 1.67 / 5
  You rated: 3 / 5 (9 votes cast)
 
[31,135 views]  

Prevent 'garbled text' file downloads via server settings | 10 comments | Create New Account
Click here to return to the 'Prevent 'garbled text' file downloads via server settings' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Prevent 'garbled text' file downloads via server settings
Authored by: bpierce on Feb 19, '04 11:15:55AM

Maybe everyone knows this, but I have a way I use to get around this problem all the time. Incidenatlly, I don't have a net connection at home, so don't surf on my Mac--I have to use my XP machine at work, but something like this should work on a Mac, too.

I right-click on the download link and choose "Save link to disk..." in Firebird/Firefox, and I think it's "Save Target As..." in IE. This brings up a standard save dialogue and I can save the .dmg just fine.

---
~Brandon



[ Reply to This | # ]
Prevent 'garbled text' file downloads via server settings
Authored by: RideMan on Feb 21, '04 09:14:47PM

Sounds familiar; frequently I've downloaded stuff at work using Opera on an XP box to bring home on disk.

Oddly enough, one of the offenders with a malconfigured web server that sends file archives as text happens to be Apple Computer, Inc. I think I was downloading Safari when I bumped into that one.

It's not exclusive to Apple archive files, either. I've seen sites that screw up Windows Media Player files in exactly the same way.

Oh, and those of us who occasionally download Apple ][ Shrinkit archives have been dealing with this for a long, long time...



[ Reply to This | # ]
Prevent 'garbled text' file downloads via server settings
Authored by: balthisar on Feb 19, '04 12:08:42PM

I have this line at my site root folder in .htaccess:

AddType application/octet-stream .dmg

for the exact reason that this hint was published. Still, though, I get user reports sometimes the indicate that the .dmg doesn't download, but fills the browser window -- luckily my .dmg is less than a meg.

It's already a compressed .dmg, so I'd hate to add the extra step for users by zipping or stuffing it.

Any ideas?

---
--Jim (me)



[ Reply to This | # ]
Prevent 'garbled text' file downloads via server settings
Authored by: cfoster on Feb 19, '04 08:01:03PM

The web server process may need to be restarted to notice the change to your .htaccess file. If you don't have control over restarting Apache, you may just have to wait for your admin to reboot your server.

One of the few times that UNIX's rock-solid stability can be a hinderance. :-)



[ Reply to This | # ]
Prevent 'garbled text' file downloads via server settings
Authored by: klktrk on Feb 19, '04 12:11:09PM

Some httpd.conf files get their mime type configurations from /etc/mime.types rather than from httpd.conf or other file. You might see this directive instead:
TypesConfig /etc/mime.types

Just make the changes there. So much more sensible to have it declared in a system wide place.



[ Reply to This | # ]
IE does not respect mime-type - Safari Does
Authored by: pixelfreak on Feb 19, '04 12:20:23PM

The problem is that, when deciding how to interpret the file, Internet Explorer ignores the mime-type sent with the file and uses the file extension instead. This behavior is not to spec and can cause all kinds of confusion.

Since many administrators and web developers only check their sites in IE, this behavior prevents many administrators and web developers from noticing that their mime-type settings are incorrect. In addition, administrators rarely update their servers mime-type settings, so new file formats such as disk images and .sitx are served as text/plain.

However, standard compliant browsers like Mozilla, Safari, etc. use the mime-type provided, which causes this content to be interpreted as text and displayed as really big canvas of abstract ASCII art in your browser.



[ Reply to This | # ]
Prevent 'garbled text' file downloads via server settings
Authored by: Cantus on Feb 20, '04 02:42:11AM

Is there anything that can be done from the user end to avoid this?



[ Reply to This | # ]
complain
Authored by: hayne on Feb 20, '04 09:03:54AM

As an end-user, you should:
1) Be ready to hit the browser "stop" button in case this problem occurs - and then use the contextual menu to download the linked file.

2) Complain to the webmaster of sites where you encounter a problem (point them to this article)



[ Reply to This | # ]
Prevent 'garbled text' file downloads via server settings
Authored by: eno on Feb 20, '04 10:53:30AM

Excellent hint!I have .dmg files on my server and get the occasional complaint... hopefully this will fix it in the vast majority of circumstances...



[ Reply to This | # ]
Prevent 'garbled text' file downloads via server settings
Authored by: mrelwood on Mar 14, '07 01:25:57PM

I just had to register to say this. I was really annoyed at this problem, but now found an user-end solution thanks to this thread.

From the download preferences, set the default action for plain text files (.txt) to show download dialog. You must uncheck "Hide types opened with Opera" in order to get to the .txt type.

This will be a bit boring if you open a lot of .txt files in links.... (since they also open the dialog) but who opens txt-links? I don't.

I hope this is helpful for others also.



[ Reply to This | # ]