Create an Asset
webflow.createAsset(fileBlob)
Create an asset on a site. Uploaded assets must adhere to specific size limitations:
- Images must not exceed 4MB
- Documents are capped at 10MB
Refer to the accepted MIME types listed below for compatibility. Lottie files should be passed as application/json
MIME types.
MIME Types
Syntax
Parameters
- fileBlob:
File
- Represents a valid File to be uploaded. Refer to the examples below for guidance on uploading an asset from a remote source and directly from a file picker.
Returns
Promise<Asset>
A Promise that resolves to the new Asset.
Example
Remote Source
Direct Upload
HTML
Errors
If the method fails to create an asset, the method will return an error with the following cause and message.