I wanted to post this for those that may need it and were having problems with getting the MIME types to work on some file types.

I have a project that required .dwf, .dwg, .sldprt, .sldasm, .slddrw file types. I added this to the function file_document_mime_types() (starts on line #59 in alpha3, alpha4 and dev versions):

    'application/dwg' => array(
      'name' => t('AutoCAD Drawing'),
      'icon' => 'dwg.gif',
    ),
    'application/dwf' => array(
      'name' => t('Autodesk Drawing Web Format'),
      'icon' => 'dwf.gif',
    ),
    'application/sldworks' => array(
      'name' => t('Solidworks Assembly File'),
      'icon' => 'sldasm.gif',
    ),
    'application/sldworks' => array(
      'name' => t('SolidWorks Part File'),
      'icon' => 'sldprt.gif',
    ),
    'application/sldworks' => array(
      'name' => t('Solidworks Drawing File'),
      'icon' => 'slddrw.gif',
    ),

I've also attached the icons I found and modified (for transparent backgrounds) for these file types.

I hope that helps someone else.

CommentFileSizeAuthor
sldprt.gif596 bytesvisualnotion
slddrw.gif338 bytesvisualnotion
sldasm.gif612 bytesvisualnotion
dwg.gif625 bytesvisualnotion
dwf.gif1.04 KBvisualnotion
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

visualnotion’s picture

I should have included this info in the above topic, as well.

I used these sites for finding the MIME types and icons (if it keeps someone else from having to waste time digging for it elsewhere):

miglius’s picture

Status: Active » Postponed (maintainer needs more info)

Thanks for sharing it. I'm curious - I understand that this code will print the icon and the MIME description in the MIME listing page, but I don't see how it can really help in detecting the MIME type from the file extension. So I assume that MIME detection for you was working even before those lines were added? Wasn't it the case?

The code above is intended to extend the mime.types mapping, but to do that you would need to add an 'extensions' key which would associate the MIME type with file extension:

    'audio/vnd.rn-realaudio' => array(
      'name' => t('RealAudio file'),
      'extensions' => array('ra', 'ram'),
    ),
ctalley5’s picture

Wow I'm so glad you posted this... exactly what I was going to ask about (DWG & DWF formats). So when you upload a DWG file using this format, does it automatically create a preview of it & PDF view?

Thanks for posting this, really helpful.

ctalley5’s picture

However - I'm new... and am sure i am overlooking something, or looking at the wrong files.

Searching for function file_document_mime_types() (starts on line #59 .... I am unable to find. Has this code been changed since?

miglius’s picture

DWG or DWF files are not automatically converted to PDF unless there is any conversion utility which could be used by this module.

ctalley5’s picture

Ahh I see... That's fine.

I'm still curious though, why I cannot seem to find the function "file_document_mime_types" anywhere.

Thanks,

miglius’s picture

It is in the 'fileframework/formats/document/file_document.module file.

ctalley5’s picture

Okay have it all figured out..... have a DWG upload, as well as Icon working. Thanks for your help.

Now - I understand that .DWG filetypes have the capability of providing previews. I was curious if it was going to show up - but i guess nothing's that easy, right.

Does anybody have any ideas about that?

Thanks again - module's great.

johanneshahn’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

no activity