Create a temporary file initialised with the contents of the provided media, if any.
__enter__() → string
Creates a temporary client-side URL for a Media object, even if the media has no permanent URL. This URL should be revoked when you are finished with it. If you use TempUrl as a context manager (‘with TempUrl(media) as url:‘), this happens automatically; if you instantiate it manually you must call ‘revoke()’ on the instance.
The download argument only affects LazyMedia objects
__enter__() → url
get the url using a ‘with’ block.
Revoke a url when exiting a ‘with’ block
revoke a url from a media object
url - string
the temporary url
Download the given Media Object immediately in the user’s browser.
from_file(filename, [mime_type], [name]) → anvil.Media instance
Creates a Media object from the given file.
open(media) → BytesIO
Open a media file as Python BytesIO object
Print the given Media Object immediately in the user’s browser.
Write a Media object to the given file
Do you still have questions?
Our Community Forum is full of helpful information and Anvil experts.