You can read the contents of the file into a binary string, then create a BlobMedia
with it. Then you can pass that media object into add_row()
on a database table which has a Media column.
BTW, you won’t want to call get_url()
on a Media object from a table (that will get you a temporary URL that’s only valid from this browser session, which is no good if you want to pass it to an API). Instead, create an HTTP Endpoint in your Anvil app, and have that return the appropriate Media when you call it. (You can use parameters to request different files from the same endpoint.)