$fn.getUploadFiles()
Retrieve files uploaded with the push button or icon button."asynchronous"
Arguments
None
Return value
Type | Description |
---|---|
Promise <FileInfo[]> | Uploaded file information |
Object | Property | Type | Description |
---|---|---|---|
FileInfo | data | Buffer | File data |
filename | string | File name | |
filesize | number | File size |
Sample
try { // The return value is an array of objects const files = await $fn.getUploadFiles(); await Promise.all(files.map(async (file) => { const path = `/uploads/${file.filename}`; // Save the file to the specified path await $fn.putFile(path, { data: file.data, }); }));} catch (err) { console.error("Error ", err);}