For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Resources
Get started
ReferenceGuidesExamplesChangelog
ReferenceGuidesExamplesChangelog
  • Designer API
    • Introduction
    • Getting Started
    • Webflow CLI
    • Error Handling
    • App Modes
  • Elements
    • Creating & Retrieving Elements
    • Element Properties & Methods
    • Element Types & Methods
  • Styles
    • Managing Style Properties
    • Managing Variable Modes
  • Components
  • Variables & Collections
    • Variable Collections
    • Variables
    • Variable Modes
  • Assets
      • Get Asset Name
      • Set Asset Name
      • Get Alt Text
      • Set Alt Text
      • Set Asset File
      • Get Asset MIME Type
      • Get Asset URL
      • Get folder of Asset
      • Set folder for Asset
  • Pages & Folders
  • Utilities
    • User Events & Notifications
    • App Intents & Connections
  • Additional Resources
    • API Playground
    • FAQs
LogoLogo
Resources
Get started
On this page
  • asset.setFile(fileBlob)
  • Syntax
  • Parameters
  • Returns
AssetsManaging Assets

Set Asset File

Was this page helpful?
Previous

Get Asset MIME Type

Next
Built with

asset.setFile(fileBlob)

Set the file of an asset. Use this method to replace the file of an existing asset with a new file.

Syntax

1asset.setFile(fileBlob: File): Promise<null>

Parameters

  • fileBlob: File - The file to set the asset to.

Returns

A Promise that resolves to null.

Example

1const assets = await webflow.getAllAssets();
2const asset = assets[0];
3const newFile = new File([blob], 'marvin-smiling.png', { type: 'image/png' });
4await asset.setFile(newFile);

Try this example

Designer ability

Designer AbilityLocaleBranchWorkflowSitemode
canManageAssetsAnyAnyAnyAny