Skip to main content

Upload Files

Upload one or more files and attach them to a record's Files and Images field.

Upload File

Makes one or more files uploaded from the user's browser available to the function of your choice, such as update_record.

upload_file(files: FileBulk[]): Promise<FileDetails[]>;
Parameter NameTypeDescription
filesFileBulk arrayAn array of file data formatted for consumption by Files and Images fields.
Example Script - Upload Files

<!-- upload_file(files: FileBulk[]): Promise<FileDetails[]>;-->

<script>
window.SmartSuite.upload_file().then((res) => {
console.log('result file =>>>', res);
window.SmartSuite.update_record('67647d9b7a03fad7da12d9f2', '67647dd4b4761f19a7b55692', {
id: '67612a673a8cba5225a819ra',
s8f119717f: res[0],
}).then((res) => {
console.log('result update record=>>>', res);
});
});
</script>

Response

200 Ok - File Upload
[
{
"handle": "C1cuxxxxxxxxxxxxxxxF",
"metadata": {
"container": "smart-suite-media",
"filename": "download.png",
"key": "7Yx4hdxxxxxxxxxx3sbw_download.png",
"mimetype": "image/png",
"size": 6273
},
"transform_options": {},
"author": 10368,
"security": {
"policy": "eyJjYWxsIjogWyJyZWFkIiwgImNvbnZlcnQiXSwgImV4cGlyeSI6IDE3MzQ3MzU2MzkuNDAwMjM2LCAiaGFuZGxlIjogIkMxY3VRck9QUWcybFlyRTdGT3dGIiwgIm1heFNpemUiOiA1MDAwMDAwMDAwfQ==",
"signature": "ba6280xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx5c47f1de6080308c7"
},
"file_type": "image",
"icon": "image",
"video_conversion_status": "none",
"video_thumbnail_handle": "",
"converted_video_handle": null
}
]