Discussion:
mime type, enable .dwg in Apache
Amanda Wynne
2002-10-31 02:34:24 UTC
Permalink
I'm trying to make a hyperlink to an AutoCad .dwg file. A search on Google reveals the correct mime type to use is
image/vnd.dwg

which is in my mime.types file for Apache.

In Mozilla I've added, under "helper applications", extension dwg, mime type image/vnd.dwg, handled by application C:\Program Files\AutoCAD LT 2000i\aclt.exe.

I suspect I need to add an entry into httpd.conf about

AddEncoding vnd.dwg dwg

but I'm not sure about the syntax; or even if I'm on the right track here.

When I click on the hyperlink, I get a screen full of garbage text.

Can somebody point me in the right direction, or offer some hints?

Thanks.

Amanda
Glen Turner
2002-11-01 01:39:28 UTC
Permalink
Post by Amanda Wynne
I suspect I need to add an entry into httpd.conf about
AddEncoding vnd.dwg dwg
Hi Amanda,

Almost right. When you send a page using HTTP as the
transfer protocol that page will have a HTTP header
containing the Content-Type and an optional HTTP
header describing the Encoding.

The Content-Type is what you want to alter so that clients
can be told that the downloaded content is a AutoCAD file.

The Encoding is how the content appears on the wire. It
usually appears on the wire as it appeared in the file
on your disk, but it could have optionally be compressed
using gzip.

To set the Content-Type on the Apache web server you can
either modify /etc/mime.types or alter Apache's configuration.
My experience is that altering the configuration is better.

My experience is also that adding the new types to /etc/httpd/
conf/httpd.conf leads to trouble during upgrades and adding
a new configuration file is better.

So create a file /etc/http/conf/type.conf.

Add the lines

# Local mappings of file extensions to HTTP Content-Type

# AutoCAD
# Ref: http://support.autodesk.com/ knowlegde base ID TS65651
AddType image/vnd.dxf .dxf
AddDescription "AutoCAD" .dxf
AddType image/vnd.dwg .dwg
AddDescription "AutoCAD map" .dwg
AddType drawing/x-dwf .dwf
AddDescription "AutoCAD drawing web format" .dwf

At the end of /etc/httpd/conf/httpd.conf add

# Local content types
Include conf/type.conf

The AddDescription setting appears in directory listings. It
has no other effect. You can also use AddIcon to add icons
to directory listings, being a CAD person you've probably
got the talent to come up with something suitable.

Now restart Apache

service httpd restart

and check that there are no typing errors in the
configuration file by looking for error messages:

tail -100 /var/log/httpd/error_log
--
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug
Amanda Wynne
2002-11-01 04:30:10 UTC
Permalink
I've got, in my mime.type file, the entry "image/vnd.dwg .dwg".
When I access the page with IE, the link works correctly, with the option to
either save the file to disk or open it with Autocad. Which works fine.

With Netscape or Mozilla, it just treats it like a text file.

I also just found the following information from
http://www.dot.co.pima.az.us/gis/webdev/dwg.htm

* If you have AutoCAD itself installed, then you can use AutoCAD as an
application external to your web browser to open and view the DWG file.
When you click on a .DWG with Internet Explorer, it should give you the
option of saving the file to disk, or opening it. Assuming you have AutoCAD
installed, choose "Open", unless you have a need to save the DWG file to
your disk. Choosing "Open" should start AutoCAD and display the map.
When you click on a .DWG with Netscape, you may only have the option to
save it to disk. Also, if the filename extension of the file to save is not
listed
as DWG, then change it to DWG. Once saved to disk with the DWG extension,
you can start AutoCAD and open it from your hard disk like any other
AutoCAD drawing. We're trying to learn how to configure Netscape to open DWG
files directly. If you know how, contact
***@dot.co.pima.az.us.

So it seems my problem is actually browser based, rather than server based.

I've tried adding an entry in Mozilla, under "helper applications" to get it
to associate dwg files with Autocad, with no success yet.
Also, the filetype .sam, which is an AmiPro document, will open in IE &
Mozilla, but not Netscape.

Amanda

----- Original Message -----
From: "Glen Turner" <***@aarnet.edu.au>
To: "Amanda Wynne" <***@controlsystems.com.au>
Cc: <***@slug.org.au>
Sent: Friday, November 01, 2002 12:39 PM
Subject: Re: [SLUG] mime type, enable .dwg in Apache
Post by Glen Turner
Post by Amanda Wynne
I suspect I need to add an entry into httpd.conf about
AddEncoding vnd.dwg dwg
Hi Amanda,
Almost right. When you send a page using HTTP as the
transfer protocol that page will have a HTTP header
containing the Content-Type and an optional HTTP
header describing the Encoding.
The Content-Type is what you want to alter so that clients
can be told that the downloaded content is a AutoCAD file.
The Encoding is how the content appears on the wire. It
usually appears on the wire as it appeared in the file
on your disk, but it could have optionally be compressed
using gzip.
To set the Content-Type on the Apache web server you can
either modify /etc/mime.types or alter Apache's configuration.
My experience is that altering the configuration is better.
My experience is also that adding the new types to /etc/httpd/
conf/httpd.conf leads to trouble during upgrades and adding
a new configuration file is better.
So create a file /etc/http/conf/type.conf.
Add the lines
# Local mappings of file extensions to HTTP Content-Type
# AutoCAD
# Ref: http://support.autodesk.com/ knowlegde base ID TS65651
AddType image/vnd.dxf .dxf
AddDescription "AutoCAD" .dxf
AddType image/vnd.dwg .dwg
AddDescription "AutoCAD map" .dwg
AddType drawing/x-dwf .dwf
AddDescription "AutoCAD drawing web format" .dwf
At the end of /etc/httpd/conf/httpd.conf add
# Local content types
Include conf/type.conf
The AddDescription setting appears in directory listings. It
has no other effect. You can also use AddIcon to add icons
to directory listings, being a CAD person you've probably
got the talent to come up with something suitable.
Now restart Apache
service httpd restart
and check that there are no typing errors in the
tail -100 /var/log/httpd/error_log
--
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug
Amanda Wynne
2002-11-01 05:31:03 UTC
Permalink
Just a quick followup.
I got it sussed.
"image/vnd.dwg" doesnt work.
"image/vnd.dwg dwg" does work.

similarly for amipro *.sam documents.
"application/vnd.lotus-amipro sam"

Amanda
--
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug
Loading...