loading table of contents...

8.1.15. Upload Files

The upload files dialog can be invoked from the new content menu or the library. The dialog shows a drop area and the folder combo box the uploaded documents will be imported into. Files can be dragged and dropped here from the desktop or the file system explorer. After the drop, the files are enlisted with a preview (if supported by the OS), a name text field and a mime type combo box. The mime type is automatically determined by the OS, but can be changed by selecting another value. After pressing the confirmation button the files are uploaded and corresponding documents are created. The user may choose to open the documents automatically after the upload is finished. Otherwise, the generated documents are checked-in.

The upload files dialog

Figure 8.22. The upload files dialog


How to configure the upload settings

The upload settings are stored in the settings document UploadSettings in folder /Settings/Options/Settings. The default configuration has the following format:

<Struct xmlns="http://www.coremedia.com/2008/struct" xmlns:xlink="http://www.w3.org/1999/xlink">
      <StringProperty Name="defaultFolder">Editorial</StringProperty>
      <StringProperty Name="defaultContentType">CMDownload</StringProperty>
      <StringProperty Name="defaultBlobPropertyName">data</StringProperty>
      <IntProperty Name="timeout">300000</IntProperty>
      <StringListProperty Name="mimeTypes">
        <String>application/octet-stream</String>
        ...more mime types...
      </StringListProperty>
      <StructProperty Name="mimeTypeMappings">
        <Struct>
          <StringProperty Name="image">CMPicture</StringProperty>
          <StringProperty Name="application">CMDownload</StringProperty>
          <StringProperty Name="audio">CMAudio</StringProperty>
          <StringProperty Name="video">CMVideo</StringProperty>
          <StringProperty Name="text">CMDownload</StringProperty>
          <StringProperty Name="text/css">CMCSS</StringProperty>
          <StringProperty Name="text/javascript">CMJavaScript</StringProperty>
          <StringProperty Name="text/html">CMHTML</StringProperty>
        </Struct>
      </StructProperty>
      <StructProperty Name="mimeTypeToMarkupPropertyMappings">
        <Struct>
          <StringProperty Name="text/css">code</StringProperty>
          <StringProperty Name="text/javascript">code</StringProperty>
          <StringProperty Name="text/html">data</StringProperty>
        </Struct>
      </StructProperty>
    </Struct>
    

For a detailed description about the elements and attributes see table below.

defaultFolder
Format String
Description Defines the default folder that is selected in the folder combo box of the dialog. The value supports site specific relative folders.
defaultContentType
Format String
Description The default content type to create if the mime type of a file has no corresponding mime type mapping.
defaultBlobPropertyName
Format String
Description The default blob property name to which the file blob is written to.
mimeTypes
Format String List
Description The available mime types for the mime type combo box.
mimeTypeMappings
Format Struct
Description Depending on the mime type the content type to generate is mapped here. Here the primary type or the whole mime type can be specified.
mimeTypeToMarkupPropertyMappings
Format Struct
Description Depending on the mime type the markup property name to which the file is written
timeout
Format Integer
Description The timeout in milliseconds for uploads, default value is 300000.

Table 8.3.  Upload Settings


How to intercept the content's properties before creation

There is an example of a Content Write Interceptor contained in the Upload REST extension:

<bean id="pictureUploadInterceptor" class="com.coremedia.blueprint.studio.rest.intercept.PictureUploadInterceptor">
      <property name="type" value="CMPicture"/>
      <property name="imageProperty" value="data"/>
      <property name="blobTransformer" ref="blobTransformer"/>
      <property name="extractor" ref="imageDimensionsExtractor"/>
      </bean>

It is a Content Write Interceptor for CMPicture content type which scales an uploaded image blob to a configurable max dimensions and writes the image dimensions to the width and height String property of the image document. See the [CoreMedia Studio Developer Manual] for Content Write Interceptor.