Skip to content

$fn.getUploadFiles()

Retrieve files uploaded with the push button or icon button."asynchronous"

Arguments

None

Return value

TypeDescription
Promise <FileInfo[]>Uploaded file information
ObjectPropertyTypeDescription
FileInfodataBufferFile data
filenamestringFile name
filesizenumberFile 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);
}