mime

Post Reply
User avatar
Thunderstone
Site Admin
Posts: 2504
Joined: Wed Jun 07, 2000 6:20 pm

mime

Post by Thunderstone »



In my TEXIS script I provide an option for the user to save the results
to disk. I use a form with a .bin and a mime-type <<cr><<cr> as the first
3 lines.

As follows:

<<form method=get action="/scripts/texis.exe/scripts/x4/ericdb.bin">

Content-Type: application/octet-stream


When the user selects this, the name ericdb.exe is pre-loaded into the
save. Is there a way to preload "eric.txt" instead? The .exe extension is
making people believe it is an executable rather than a text file.



--------------------------------------------------------------

Larry Rudner rudner@cua.edu

ERIC Clearinghouse on 800 464-3742 (after 2/26/98

Assessment and Evaluation 301-405-7449

Shriver Laboratory

College Park, MD 20742 http://ericae.net


User avatar
Thunderstone
Site Admin
Posts: 2504
Joined: Wed Jun 07, 2000 6:20 pm

mime

Post by Thunderstone »



Larry Rudner said:

If you are sending a text file, then you should use the .txt extension, e.g.

<form method=get action="/scripts/texis.exe/scripts/x4/ericdb.txt">

and Texis will add the appropriate Content-Type, so you do not need to
supply it.


User avatar
Thunderstone
Site Admin
Posts: 2504
Joined: Wed Jun 07, 2000 6:20 pm

mime

Post by Thunderstone »



I was not clear with my question. Following the manual
http://www.thunderstone.com/vortexman/node16.html I added the .bin mime
so I could provide the content-type. .txt mime will provide content-type:
text/html which the browser will happily display. Using .bin mime and
content-type: application/octet-stream, I can direct the browser to save
(rather than display) the file. My goal is to direct the browser to save
the file with a .txt extension rather than .exe or .bin. I would imagine
some type of HTTP header will provide the name, but I can't figure it out
from the on-line w3 http header info. Any ideas?

In the example, x4 is a texis script, ericdb is a routine within x4.

--------------------------------------------------------------
Larry Rudner rudner@cua.edu
ERIC Clearinghouse on 800 464-3742 (after 2/26/98
Assessment and Evaluation 301-405-7449
Shriver Laboratory
College Park, MD 20742 http://ericae.net


User avatar
Thunderstone
Site Admin
Posts: 2504
Joined: Wed Jun 07, 2000 6:20 pm

mime

Post by Thunderstone »




Keep in mind that regardless of what headers your script sends, it is
up to the browser to save the data to a file or not. While giving a
Content-Type of application/octet-stream will usually cause a file-save
dialog to appear, some browsers may well be configured to display that
type or start a plug-in. Your script at the server can't know.
You may be able to use a Content-Disposition header to indicate a
preferred filename for the browser to save as. Check the MIME RFC
(1521) and others for details.

-Kai


Kai Getrost | Thunderstone Software - EPI, Inc.



Post Reply