loading... Pacem JS

Binary Input

PacemUploadElement is the suggested webcomponent for file uploads.

Metadata

The PacemUploadElement can be included in an autogenerating form using the proper metadata.

In the following example, the url attribute for a chunked upload is provided via the extra's uploadUrl property.
It is important to say that the provided endpoint on the server-side is expected to obey an optionated schema, moreover the resulting value is the string yielded by the endpoint when the upload process comes to completion.

{ "display": { "cssClass": ["form-minimal"] }, "props": [ { "prop": "file", "display": { "name": "File (upload)", "cssClass": ["upload-std"] }, "type": "file", "dataType": "upload", "commands": [{ "icon": "preview", "name": "preview", "dependsOnValue": true, "tooltip": "preview" }], "validators": [ { "type": "binary", "errorMessage": "Invalid file: must be a pdf, doc or an image not exceeding 1MB", "params": { "pattern": "\.(pdf|docx?|xlsx?|jpe?g|png)$", "maxSize": 1048576 } } ] } ]}