File Events
Events fired by the File Upload widget and the document previewer. Each event calls a dedicated FormHostProvider action.
| Event | FormHostProvider action |
|---|---|
| File upload (file widget) | runFormUploadFiles |
| File upload (datatable) | runFormEvent |
| File delete | runFormDeleteFileEvent |
| File download | runFormDownloadFileEvent |
| File preview | runFormGetLinkedFileEvent |
| File metadata | runFormGetLinkedFileMetaEvent |
| Chunked download | runFormGetLinkedFileByChunks |
| Presigned URL | runFormGetPresignedUrl |
onFileUpload — runFormUploadFiles
Fired when the user uploads a file via the File Upload widget.
{
"content": {
"fieldName": "attachments",
"files": [{ "name": "report.pdf", "size": 204800, "type": "application/pdf" }],
"widgetName": "attachments",
"widgetEvent": "onFileUpload",
"widgetContext": {
"hasParentForm": false,
"originator": null,
"folderData": null
},
"formData": { "name": "Project Alpha" }
}
}
onFileUploadCreateDocument — runFormEvent
Fired when the user uploads a file via the datatable file upload widget.
{
"content": {
"fieldName": "attachments",
"files": [{ "name": "report.pdf", "size": 204800, "type": "application/pdf" }],
"widgetName": "documentstbl",
"widgetEvent": "onFileUploadCreateDocument",
"widgetContext": {
"hasParentForm": false,
"originator": null,
"folderData": null
},
"formData": "{}",
"uploadMode": "single"
}
}
File Delete — runFormDeleteFileEvent
Fired when the user deletes a file in the File Upload widget.
{
"pluginCode": "construct",
"formCode": "documents",
"guid": "550e8400-e29b-41d4-a716-446655440000",
"projectGuid": "38I9rEPw1BmxP75XcxgzD5WGOk1",
"pGuid": "38I9rEPw1BmxP75XcxgzD5WGOk1",
"fieldName": "attachments",
"fileId": "file-abc123.pdf"
}
File Download — runFormDownloadFileEvent
Fired when the user downloads a file in the File Upload widget.
{
"pluginCode": "construct",
"formCode": "documents",
"guid": "550e8400-e29b-41d4-a716-446655440000",
"projectGuid": "38I9rEPw1BmxP75XcxgzD5WGOk1",
"pGuid": "38I9rEPw1BmxP75XcxgzD5WGOk1",
"fieldName": "attachments",
"fileId": "file-abc123.pdf"
}
File Preview — runFormGetLinkedFileEvent
Fired when the user previews a file in the File Upload widget or document previewer.
{
"pluginCode": "construct",
"formCode": "documents",
"guid": "550e8400-e29b-41d4-a716-446655440000",
"projectGuid": "38I9rEPw1BmxP75XcxgzD5WGOk1",
"pGuid": "38I9rEPw1BmxP75XcxgzD5WGOk1",
"fieldName": "attachments",
"fileId": "file-abc123.pdf",
"context": {
"action": "preview"
}
}
File Metadata — runFormGetLinkedFileMetaEvent
Fired when file metadata is requested during preview in the File Upload widget or document previewer.
{
"pluginCode": "construct",
"formCode": "documents",
"guid": "550e8400-e29b-41d4-a716-446655440000",
"projectGuid": "38I9rEPw1BmxP75XcxgzD5WGOk1",
"pGuid": "38I9rEPw1BmxP75XcxgzD5WGOk1",
"fieldName": "attachments",
"fileId": "file-abc123.pdf",
"context": {
"action": "meta"
}
}
Chunked Download — runFormGetLinkedFileByChunks
Fired when a large file is downloaded in chunks (for example, an MP4 in the document previewer).
{
"pluginCode": "construct",
"formCode": "documents",
"guid": "550e8400-e29b-41d4-a716-446655440000",
"projectGuid": "38I9rEPw1BmxP75XcxgzD5WGOk1",
"pGuid": "38I9rEPw1BmxP75XcxgzD5WGOk1",
"fieldName": "attachments",
"fileId": "video-presentation.mp4",
"range": "bytes=0-1048575"
}
Presigned URL — runFormGetPresignedUrl
Fired when a presigned URL is needed for large file preview (for example, an MP4 in the document previewer).
{
"pluginCode": "construct",
"formCode": "documents",
"guid": "550e8400-e29b-41d4-a716-446655440000",
"projectGuid": "38I9rEPw1BmxP75XcxgzD5WGOk1",
"pGuid": "38I9rEPw1BmxP75XcxgzD5WGOk1",
"fieldName": "attachments",
"fileId": "video-presentation.mp4",
"context": {
"action": "presign"
}
}