Use the bulkUpload
method to upload multiple files.
try {
const files = [
{
file: /* file_data_1 */,
directoryId: 'directory_id_1'
},
{
file: /* file_data_2 */,
directoryId: 'directory_id_2'
},
// Add more file objects as needed
];
const [data, error] = await sdk.file.bulkUpload({
files
});
// Check for success
if (error) {
console.error('Failed to upload files:', error);
} else {
console.log('Files uploaded successfully:', data);
}
} catch (error) {
console.error('An unexpected error occurred:', error.message);
}
Params
files
(array): An array of objects, each containing the properties for file uploads, includingfile
,directoryId
, andlabels
(optional).
Required API Key Permission
Upload File