File control for uploading multiple files. Supports drag and drop.
Files will be passed to the InsertUpdate procedure in a temporary table with the columns FileId, FileName, ContentType and File. The FileId column will be set to the given file id if it is an existing file that was not changed, otherwise it will be set to NULL.
It is possible to specify which file extensions the user can select from and the maximum file size allowed by creating an input validation using the File category.
The control may be pre-filled with files by providing the file information in JSON from the GetEditFields procedure. Existing files will use the FileId column and will have NULL in all other columns when saving. The data should be in the following format:
[{
"fileId": 1,
"fileName": "Reports.txt",
"contentType": "text/plain",
"contentSize": "123"
},
{
"fileId": 2,
"fileName": "ImportantReports.txt",
"contentType": "text/plain",
"contentSize": "12345"
}]
fileId: Id of the file. (mandatory)
fileName: Name of the file. (mandatory)
contentSize: Size of the file in bytes. (mandatory)
contentType: Content type of the file. (optional)
SELECT
(
SELECT
Id AS FileId,
FileName AS FileName,
ContentType AS ContentType,
DATALENGTH(FileData) AS ContentSize
FROM
dbo.UploadedFiles
FOR JSON PATH
) AS FileUploadArea