Re: opening a client application from a server?

ccc31807 <cartercc@xxxxxxxxx> wrote:

Let's say I produce the following file like

How the file is produced in not relevant, so I snipped it.

If I create a hyperlink on an HTML page, like
<a href="outfile.xml">XML DOC</a>
a user can click the link, and the web server will return outfile.xml
to the browser.

If I give the file an xls extension, on a Windows machine running IE
the file will open in Excel.

Sounds like your server is not configured to know what content
type goes with an extension of .doc.

I just don't understand where I should specify the content type.

In the HTTP headers, specifically in a header named "Content-Type".

If you have a CGI program where you've slurped in the contents of
the Word file into $doc, then this should do it:

print "Content-Type: application/msword\n\n";
print $doc;

If it is a static link like in your example above, then you must
have your server configured to send the correct Content-Type header.

My apache, for instance, uses the /etc/mime.types file
to associate a file extension with a content-type.

grep msword /etc/mime.types
application/msword doc

If the CGI approach above works, yet the link approach does not work,
then you can be pretty sure that the root cause of your problem has to
do with web server configuration.

It most certainly has nothing to do with Perl...

Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"