+

Search Tips   |   Advanced Search

Configure MIME types for Files


Overview

We can configure Files to assign a specific MIME type to files with specific extensions. MIME types tell operating systems what applications to open, and what applications to display in the file open windows. Some applications do not download files that do not have a MIME type they support.

This configuration applies to files uploaded through the web user interface. The configuration is ignored if a third party application assigns MIME types to extensions using the API.

We can also map extensions to icons.


Configure MIME types for Files

  1. Check out the Files configuration files:

    To get cell name...

  2. Edit mime-files-config.xml
    <mapping mimeType="..." mediaType="..."> 
      <extension></extension> 
      <extension></extension> 
      .... 
    </mapping>

  3. In the mimeType attribute specify a mime type in standard format, for example...

      text/plain

    Each value must be unique compared with other mimeType values in other mapping elements, or an error is returned when we start the system.

    For example, using the entry...

      <extension openFromWeb="true">jpg</extension>

    ...displays an Open this file button in the Files user interface for files that have the .jpg file extension. This allows users to directly open this file type in their in browser, provided their browser supports this action.

        
      <mapping mediaType="image" mimeType="image/jpeg">
      
          <extension>jpe</extension>
          <extension openFromWeb="true">jpeg</extension>
          <extension openFromWeb="true">jpg</extension>
      
      </mapping>

    In this example, files with an extension of .jpg will have mime-type of image/jpeg. The openFromWeb setting indicates whether this file can be opened directly in browser. This attribute only takes effect when security.inlineDownload.enabled is true.

  4. In each extension element specify the extensions to map to the MIME type. Each value must be unique compared with other extension elements in the configuration file, or an error is returned when we start the system.

  5. Apply the changes following steps in the Applying Files property changes.


Example

<mapping mimeType="text/plain" mediaType=""> 
 <extension>txt</extension> 
  .... 
</mapping>


Parent topic:
Change Files configuration property values


Related:
Customize file type icons
Start the wsadmin client
Apply Files property changes