Storing capability of anvil data tables

I want to know the storage capability of anvil data tables for my website that will be storing hundreds and thousands of images using file system. I want to know if anvil data tables are enough for this or not ?
Any suggestions ? Sample code/video will be highly appreciated for file system storage of images in anvil data tables

Welcome to the forum.

This page shows you the various plans and the storage that comes with them :

You can store images in the tables :

Do read the docs as there are many helpful snippets & blog posts covering all aspects.

2 Likes

I want to store images into data tables using file system. how can i do it ? Need suggestions and sample codes/videos are highly appreciated.

I’m not sure what you mean by “using the file system”. Can you elaborate please?

You do have ephemeral access to “/tmp” from the server modules (not the client), but there is no guarantee anything you write there will be available once your server function has completed.

Do you mean you want to upload images from the client and store them in the database?

By file system i mean making a table called ‘images’, having autoincrementing primary key (we’ll call ID). When a user uploads an image, insert a row into table, including the original name of the file and the file extension. Probably also track uploading user, date/time, etc.
Get the last insert id from that query. Save the image to “your-image-path/(ID).(ext)” in the “file system”. For ex, “/images/350.png”.

Since images would be in large number that’s why i want to use “file system” for storing them and if there is any other option please recommend.

Yes, i want client to upload images and store them into database.

Ok, I understand now, thank you for explaining that.

You can’t store permanent data on the hosted file system in Anvil. Anything stored in “/tmp” is ephemeral, ie temporary and garbage collected at unpredictable times.

If you wanted to store images on a file system rather than as media objects in the Anvil data tables, then you could run the uplink (https://anvil.works/docs/uplink) on your own server. That way you could store references to the images as you describe above. You could also look at running the open source Anvil server to take advantage of the built in data tables system on your own hardware.

But if you pick the right paid hosted plan you might find there is enough storage. You say “large number”, but how many is “large”, and how big are the images? Large means different things to different people. For example, I run a large MySQL cluster, and to me “large” means 100+ million rows a month (so I definitely need my own hardware).

If large to you is 100,000 an 10gig, then the individual plan would work. 1m rows and 100gig then the business plan would be ideal. Above that and you are into either an enterprise plan or your own hardware.