Skip to main content
Version: Next (5.0)

File upload

The uploader criterion sends a file to the server, where its processes can manage it. Below is the real criterion of the AWE React client: choose a file, change its attributes and the XML below follows.

Live preview
XML
<criteria id="demo"
label="Attachment"
component="uploader"
destination="attachments" />

The controls above write these attributes. The reference lists every attribute, its type and default. Attributes in the XSD reference

AttributeControlValues
labelLabeltext
placeholderPlaceholdertext
sizeSizesmlg
drop-zoneDrop zonetrue / false
captureCamerauserenvironment
validationRequiredtrue / false
readonlyRead onlytrue / false

The upload is simulated in these examples: the page reports the progress of the request and shows the file name and size as the server would answer, but the file is never sent anywhere; it stays in your browser. destination is the folder of the server where a real screen stores the file. With drop-zone the user can drop the file, and when it is a raster image a preview is shown. capture adds a Take photo button that opens the camera on mobile browsers.

Recipes​

Drop zone with a preview​

Drop an image on the dashed area, or choose one: it is previewed next to the field, and Clear removes the file.

<criteria id="photo" component="uploader" label="Photo" destination="photos" drop-zone="true" />

Events and actions​

A criterion has no event of its own to listen to: every change of its value checks the dependencies whose dependency-element names it, and pressing Enter in a text field runs the submit button of its window. The actions that work on criteria:

ActionDescription
resetEmpties the value of the criterion
restorePuts back the initial value of the criterion
validateRuns the validation of the criterion and shows its error
set-invalidMarks the criterion as invalid with the message of the action
set-validClears the validation error of the criterion
copy-criterion-value-clipboardCopies the value of the criterion to the clipboard

More​