How to upload zip file in data tables from jupyter notebook

I want to upload zip file from jupyter notebook to data tables with the help of file loader so how we can do that?

I already uplinked my notebook with anvil and also its upload zip file on anvil but not on data table I also want to save it on data table and want to done this by using file loader instead of path of zip file .

Hello,

If you select a zip file from the file loader, you have a media object. Media objects can be saved directly into Anvil’s data tables.

Please search the documentation for “media objects” and “data tables” as there are many examples of how to store media objects in data tables. Here are some pages to get you started but there are many more.

https://anvil.works/blog/announcing-table-media
https://anvil.works/docs/data-tables

Once you have read those docs (if you have not already), please share your code or a small clone link if there are further questions. This will help us assist you more directly if we are able.


mod note: continued from How to upload folder on Anvil Form

1 Like

How to solve this error?

this my python code and I want to print file names of my uploaded file in data tables.

# import app_tables to access your data tables
from anvil.tables import app_tables

@anvil.server.callable
def save_file(file):
    app_tables.uploaded_files.add_row(f = file)   #perfectly working till here :)))
    uploaded_files = app_tables.uploaded_files.search()
    for f in uploaded_files:
        print(f"This file's name is {f['f']}")
    
anvil.server.call('save_file')

anvil.server.wait_forever()

Some error messages can be a little unclear, but this one is pretty direct. Do you see any clues in this error message?
“save_file() missing 1 required positional argument: ‘file’”

Edit: hint: every function call has two ends:

  1. Where the function is defined
  2. Where the function is called
1 Like