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 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