HOWTO: Change the Default Document Type When Importing a File in the Nuxeo Platform?

Updated: July 11, 2024

In this how-to, importing a file can correspond to using the drag and drop, using the Import button, or adding a file from Nuxeo Drive or a WebDAV drive.

When we drag and drop a file on a folder or workspace, a new document of type (File, Image, Picture, Contract...) is automatically created depending on the MIME Type and file extension. For example, dragging a .png file creates a Picture.

The mechanism to create a Nuxeo document with an import is tight to the plugins extension point from the FileManager service.

According to the MIME type of the file you try to import, a specific plugin will be called. And most of the time, it's the DefaultFileImporter plugin that will be used.

So, to create a document of your own type, you have to set the docType attribute when overwriting the default contribution. In this example, uploading a MS Word or a PDF document (.doc, .docx and .pdf) will automatically create a new Contract document:


<extension target="org.nuxeo.ecm.platform.filemanager.service.FileManagerService" point="plugins">
  <plugin class="org.nuxeo.ecm.platform.filemanager.service.extension.DefaultFileImporter" name="ContractImporter" order="1" docType="Contract">

  <plugin class="org.nuxeo.ecm.platform.filemanager.service.extension.DefaultFileImporter" name="DefaultFileImporter" order="100">

It is necessary to pay attention to the following settings:

  • Order attribute: Indicates the order to load the plugin. Nuxeo starts loading the highest number first. The lowest at the end, so using 1 as order your configuration prevails in case of coincidence.
  • DocType attribute: Indicates the type of document to generate. In this case, a Contract type document
  • Tags filter: Define the types


Going Further

This mechanism is also valid with any document type inherited from File, as Picture, Audio or Video.

Learn more
DAM Configuration video on Hyland University: Learn how to type a file as Picture according to its file extension.