Configure MIME types for Files 

You can assign Multipurpose Internet Mail Extensions (MIME) types to file extensions.


Before starting

To edit configuration files, use the IBM WAS wsadmin client. See Starting the wsadmin client for information about how to start the wsadmin command-line tool.


About this task

You can configure Files to assign a specific MIME type to files with specific extensions. Files with MIME types tell operating systems what applications to open them with, and what applications to display in file open windows. MIME types make it easier for users at a glance to know what type of data a file contains. Also, some applications do not download files that do not have a MIME type that 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. See the topic Files API for information about how to assign MIME types through the API.

You can also map extensions to icons. See the topic Customize file type icons.


Procedure

  1. Start the wsadmin client.

  2. Start the Files Jython script interpreter.

    1. Access the Files configuration files:

        execfile("filesAdmin.py")

        If you are asked to select a server, you can select any server.

    2. Check out the Files configuration files using the following command:

        FilesConfigService.checkOutConfig("<working_directory>", "<cell_name>")

        where:

        • <working_directory> is the temporary working directory to which the configuration XML and XSD files are copied. The files are kept in this working directory while you make changes to them.

            Note: AIX and Linux only: The directory must grant write permissions or the command will not run successfully.

        • <cell_name> is the name of the WAS cell hosting the IBM Connections application. This argument is required. If you do not know the cell name, you can determine it by typing the following command in the wsadmin command processor:

            print AdminControl.getCell()

        For example:

        FilesConfigService.checkOutConfig("/opt/my_temp_dir", "CommServerNode01Cell")

  3. Navigate to the working directory specified in Step 2b and open the mime-files-config.xml file. The contents look like this:

      <mapping mimeType="..." mediaType="..."> 
            <extension></extension> 
            <extension></extension> 
            .... 
      </mapping>

  4. 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 you start the system. See the Internet Assigned Numbers Authority (IANA) web site for a list of MIME types.

      Note: The mediaType attribute is not supported in this release.

  5. In each extension element specify the extensions that you want 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 you start the system.

  6. Apply the changes following steps in the Apply Files property changes.

Example

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


Parent topic

Change Files configuration property values

Related concepts
Files API


Related tasks


How do I enable the mobile version?
Customize file type icons
Starting the wsadmin client
Apply Files property changes

+

Search Tips   |   Advanced Search