Home > @modelo.io/api > Asset > upload

Asset.upload() function

Upload an asset to cloud.

Signature:

function upload(file: File, configOrOnProgress?: UploadAssetConfig | ProgressFn): Promise<AssetData>;

Parameters

ParameterDescription
fileThe file object of the asset.
configOrOnProgressConfig object for asset uploading. Accept config object or onProgress callback function

Returns:

Promise<AssetData>

a promise contains asset object

Example

// using config object
Modelo.Asset.upload(file, { type: 'dwg', onProgress: (percentage) => console.log('upload', percentage) })
// shortcut if progress report is the only thing needed
Modelo.Asset.upload(file, (percentage) => console.log('upload', percentage))