How to serve .RTFs

I am maintaining a web application that displays reports from a database. Incidentally, the report will contain an attachment (usually an image / document that is also stored in the database).

We serve the attachment through a dynamic .htm resource that feeds the attachment from the database and populates the content type depending on what type of attachment it supports (we support PDFs, RTFs and various image formats)

For RTF, we ran into a problem. It looks like many Windows users do not have an association for the "application / rtf" content type by default (they have an association for the * .rtf file extension). As a result, clicking the attachment link does nothing in Internet Explorer 6.

Returning "application / msword" as the content type seems to do an RTF preview when the link is clicked, but only for people who have MS Office installed (some will not be installed and will use alternative RTF readers like OpenOffice).

This application is publicly accessed, so we have no control over the settings of the user's machines.

Has anyone here solved this before? And How? Thank!

+2


source to share


3 answers


Use application/octet-stream

content-type to force upload. Once downloaded, it should be viewable in any registered .rtf file.



+4


source


In addition to the title, Content-Type

you also need to add the following:



Content-Disposition: attachment; filename=my-document.rtf

      

+3


source


Wordpad (which on almost every Windows machine) can view RTF files. Is there a content type "application / wordpad"?

Alternatively, given the rarity of RTF files, the best solution might be to use a server component to open the RTF file, convert it to some other format (such as PDF or straight HTML) and submit that request to the client. I don't know what language / platform you are using on the server side, so I don't know what to tell you to use for this.

0


source







All Articles