Google Answers Logo
View Question
 
Q: Force Download (save as) Binary File (i.e. Word) - Windows and Mac Compatible ( Answered 4 out of 5 stars,   3 Comments )
Question  
Subject: Force Download (save as) Binary File (i.e. Word) - Windows and Mac Compatible
Category: Computers > Programming
Asked by: jonbliss-ga
List Price: $15.00
Posted: 12 Sep 2002 11:50 PDT
Expires: 12 Oct 2002 11:50 PDT
Question ID: 64354
Developing web pages in .asp with several links to word documents
residing on a secure server.  Want to force download/save as dialogue
instead of opening document, since opening requires server user
name/password.
Don't want to use zip, altering file extension etc.
Have already tried using "content-disposition" method.  Works great on
PCs (although I hear a bug in IE 5.5 causes problems) but I believe
this method will not be MAC compatible.
Javascript etc are options.
Answer  
Subject: Re: Force Download (save as) Binary File (i.e. Word) - Windows and Mac Compati
Answered By: slawek-ga on 12 Sep 2002 13:43 PDT
Rated:4 out of 5 stars
 
Hi Jon,



There is no magic solution to what you are trying to accomplish. 
Before I suggest a few methods to consider (although none of them will
give you the result you are looking for 100% of the time), here is an
explanation as to why there is not such feature that would work on
every system:

The web protocols were designed to identify the MIME Content-type
headers (type of content data), but not what task should be performed
on them once a header is identified (source + more info at:
http://webtips.dantobias.com/force.html ).

Defining what should be done with the content type once it is
identified would reduce flexibility.  Because each system is
different, a lot of systems would be unable to do what is requested of
them.

This type of dilemma has been around for a long time in other forms. 
For example, did you know that using the <BOLD> tags might not work on
some older systems?  The reason is simple: BOLD tells the browser in a
very specific way HOW to process the tag.  If your web browser does
not understand any of the commands it will give up, not knowing what
to do.  An alternate tag, which will accomplish the same job even on
older browsers, is <STRONG>.  This tag tells the browser of what the
final result should be, not how it should be created.  The browser is
than set free to accomplish its job in a way it has been told to do
it.  <BOLD> takes the control away from the web browser and not only
tells it WHAT to do, but also HOW to do it.

Not specifying how to handle the data on the remote system also lowers
the security risks (so, i.e., .exe files don't execute themselves upon
transfer).  So, main reason for not being able to do what you are
asking with a 100% success rate is security and compatibility.

Now, this is the part where you might find a little more favourable
information.  It deals with a few ways of accomplishing your task with
as much compatibility as possible:

Try using the application/octet-stream for your MIME type.  The web
site, which suggests this method, mentions MACs.  Supposedly this is
one of the better options.

ASP code to accomplish your task can be downloaded from 
http://www.asp101.com/articles/jason/filedownloadlist/filedownloadlist.zip
Another ASP example:
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?lngWId=4&txtCodeId=7351

The ASP examples are from
http://4guysfromrolla.aspin.com/home/tutorial/file/updownlo?cob=4guysfromrolla
where you will find about 30 file transfer utilities (not all for
downloading).
You might want to browser through there in case there is something
better I might have missed.

Now on the more difficult spectrum, VBScript download force:
http://www.morningz.com/mz/crystal/safilemgr/safilemgr.asp
Most browser allow download forcing by holding the SHIFT key when
clicking the file.  There is some popular browsers, which DON'T
support this feature.

I hope that between these methods you will find something that serves
you with content (since the perfect solution does not exist, but than
again the simplest of things on the web are not compatible with
everyone out there).

Thank you, and best of luck to you.
Slawek
jonbliss-ga rated this answer:4 out of 5 stars

Comments  
Subject: Re: Force Download (save as) Binary File (i.e. Word) - Windows and Mac Compati
From: pne-ga on 13 Sep 2002 06:31 PDT
 
Note that Microsoft IE ignores text/plain and application/octet-stream
MIME types as it considers them unreliable. It'll look into the data
to see what they look like and if it thinks it recognises the format
it'll treat it as that format. (For example, if you send HTML as
text/plain, it'll be rendered as HTML in MSIE.)

See, for example, http://www.htmlhelp.com/faq/html/media.html#force-download
for more information. (Or
http://groups.google.com/groups?as_umsgid=Pine.LNX.4.40.0207161504110.14156-100000%40lxplus033.cern.ch
ffor a more concise explanation :)
Subject: Re: Force Download (save as) Binary File (i.e. Word) - Windows and Mac Compati
From: pne-ga on 13 Sep 2002 06:33 PDT
 
The dantobias link is also good.
Subject: Re: Force Download (save as) Binary File (i.e. Word) - Windows and Mac Compatible
From: phi-ga on 17 Sep 2002 06:41 PDT
 
I use a program called"netants" and use "web integration" and define
mime types to download in the options. this works for windows. u might
be able to use a similiar download helper  for mac as well ( not that
I know anything abnout mac)

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy