You are currently viewing the new Anvil Editor Docs.
Switch to the Classic Editor Docs
You are currently viewing the Classic Editor Docs.
Switch to the new Anvil Editor Docs

Working With Files, Media And Binary Data

Anvil has built-in support for uploading, storing, downloading, and manipulating files and other binary data.

There are 3 ways to work with files in Anvil:

Dynamic Files, Media and Binary data

Dynamic Files, media and other binary data (pictures, uploaded files, etc.) are represented in Anvil as Media objects. Media objects are created by Anvil APIs such as FileLoader components and the Google Drive API. You can also create them directly in Python code from byte strings or source URLs.

Media objects allow you to pass binary data between client and server code.

Static Data Files

Static Data Files are files that you, as the app developer, can attach to your app. These files are available in your Server Modules. Static Data Files are useful for machine learning models, large datasets and data that stays constant or changes rarely.

To add Data Files to your Anvil app, click the + button in the Sidebar Menu, and select Data Files:

Image pointing to the plus symbol in the sidebar

Click the + button in the Sidebar Menu

Assets

Assets are files that are part of your app’s source code. For development of your app, you can add your own HTML templates, CSS files, JavaScript or images to Assets. Files in Assets are mostly used to customise your app’s Theme or to inject your own JavaScript objects.

You don’t need to write HTML, CSS or JS to use Anvil - but we know it’s nice to have the option.