Magnolia 5.3 reached end of life on June 30, 2017. This branch is no longer supported, see End-of-life policy.

Page tree
Skip to end of metadata
Go to start of metadata

BasicUploadFieldDefinition  allows you to upload files to Magnolia. This field is used in the standard XML import dialog. 

Class: info.magnolia.ui.form.field.definition.BasicUploadFieldDefinition

The basic upload field has three states. You can set properties for each.

  • Empty is the starting point where no file has been selected. You can select a file with the button or drag it into the box.

  • In progress displays a progress bar and incremental percentages and uploaded/total ratio.

  • Completed displays a success notification and summary of file info.

Here is an example how the upload file is defined for importing XML files. 

Node name

Value

 name

 

 allowedMimeTypePattern

text/xml

 binaryNodeName

import

 class

info.magnolia.ui.form.field.definition.BasicUploadFieldDefinition

 description

Select an XML file to import

 label

Import XML file

 preview

false

You can use all common field properties and the following.

PropertyDescriptionDefault value
allowedMimeTypePattern

Regular expression to filter allowed files by their MIME type. For example, to allow only Excel files set the value to application.*(excel|xls) . To allow images only, set the value to image.*. For more information about the supported pattern, see Pattern. Optional.

For digital asset management, MIME types:

  • (warning) 2.0+ are defined by the MediaType class.
  • (warning) 1.0+ are configured in /modules/dam/config/mediaTypes
.* (all types)
binaryNodeNameName of the subnode that will contain the file binary and related information.binaryNodeName
editFileFormatWhen set to true, the file extension displayed in the Format field is editable. Optional.false
editFileNameWhen set to true, the file name displayed in the Name field is editable. Optional.false
maxUploadSizeMaximum file size in bytes. Optional.2^63 (9.2 EB)

Caption properties. These are all optional properties. Values are typically retrieved from a message bundle.

PropertyDescriptionDefault text

Empty view

  
selectNewCaption Text displayed as tooltip on the upload button.Select a file to upload...
dropZoneCaption Text displayed as label for dropping invitation.or <em>drag a file into this area</em> to upload it
warningNoteCaption Text displayed in the warning note.You have aborted the upload of your file

In progress view

  
inProgressCaption Text displayed as title.Uploading file {0} ...
inProgressRatioCaption Text displayed as file upload ratio.{0} of {1} uploaded

Completed view

  
fileDetailHeaderCaption Text displayed as file detail header.File detail
fileDetailNameCaption Text displayed as file name label.Name
fileDetailSizeCaption Text displayed as file size label.Size
fileDetailFormatCaption Text displayed as file format label.Format
fileDetailSourceCaption Text displayed as file source label.Source
deleteCaption Text displayed as tooltip on the delete icon.Upload a new File...
selectAnotherCaption Text displayed on the upload button.Upload a new File...
successNoteCaption Text displayed in the success note.Your file has been uploaded successfully
errorNoteCaption Text displayed in the error note.An Error occurred while uploading your file
sizeInterruption Text displayed in the warning when file size > maxUploadSizeA file size limitation.
typeInterruption Text displayed in the warning when file type not in allowedMimeTypePatternAn unsupported upload file type.
userInterruption Text displayed in the warning when the user interrupts the upload.A user action.