How to put multiple images into data table at once

I have a folder with many images which I would like to put into a data table at once. Is there a way to upload these images at once? If there is not a way with data tables, is there a different feature which would allow me to use all of these images with only 1 upload?

Thanks

One large upload could timeout.

Have you tried with an uplink script that creates a media object with each image and adds a row to a table with the media object?

3 Likes

Hi, can you please provide some sample code for this? i’m unable to find it anywhere.
Thanks!

You can accept multiple files for upload, by using the multiple property of the FileLoader component! You’ll then get a list of media object as self.file_loader_1.files, which you can loop over and upload one by one, by passing them to a Server Function. (@stefano.menci is right – you’ll want to make a separate server call for each to avoid timeouts.)

Here’s a simple example app that uploads multiple files, and shows progress:

https://anvil.works/build#clone:5FLJ75BOJ4RZ3ONA=SLJRBULUYKKROCIIGOI2H4FA

And here it is in action:

2 Likes

I tried doing something like this to store a list of images into a data table (e.g., a user in my user table might have many pictures associated with them), but it looks like a single cell of a Media column can only contain a single image. I am assuming I will need a separate table just for images and link it to my user table.

One of my Media columns stores a Zipfile, so I can confirm that that works.

1 Like

5 posts were split to a new topic: Using multiple files with data tables