Adding Several Attached Files

Got something cool to share with AppGini users? Feel free to post it here!
Post Reply
Posts: 21
Joined: 2019-07-25 08:05

Adding Several Attached Files

Post by jnewtcomp » 2019-11-06 21:25


I need to add 1 to 5 or more files under one table. Currently I can only attach one file. Please advise if this is possible.

Thank you!

AppGini Super Hero
AppGini Super Hero
Posts: 524
Joined: 2019-05-21 22:42

Re: Adding Several Attached Files

Post by onoehring » 2019-11-08 16:22

Hi jnewtcomp,

you could (should!) create a 1:n relation in your application. This means create a new table which takes the primary key from your current table and another field which holds some uploaded file. This way you can have unlimited files per record.

You also might (I consider this bad database design) add five fields to your table and any of those is an upload field. This will limit the number of possible uploads to 5.

I have written for an application some additional php code which allows the admin to set the number of max uploaded files per record (database design: 1:n relationship). If the admin sets 5, the user can upload 5. Once there are five images and the user uploads a 6th, the oldest uploaded file will be removed, so that again only five files for this record exist. As in my case this is used for documentation the behavior is the one the customer expected. If the max number is changed this will trigger (or not) some more actions. Also, I do show the number in the footer of the details (and if you access the "Bilder" (images) page also in the header: (10 Bilder max. je Container)
Screenshot - 08.11.2019 , 17_20_55.png
Screenshot - 08.11.2019 , 17_20_55.png (3.73 KiB) Viewed 489 times
unlimited_images_ver001.png (22.42 KiB) Viewed 489 times

Some postings I was involved, you might find useful:
Backup your database (viewtopic.php?f=4&t=3341); Improve security (viewtopic.php?f=4&t=3168); Field Permissions (viewtopic.php?f=4&t=3308); Custom (error) message (viewtopic.php?f=7&t=1740&p=10871#p10906); Audit Log (viewtopic.php?f=4&t=1369&p=10407); Two Factor Authentication (viewtopic.php?f=7&t=3306&p=11478); Add 2nd SAVE CHANGES button (viewtopic.php?f=2&t=3242&p=11104); Place a search on details view (viewtopic.php?f=2&t=3479&p=12484#p12484); Column-Value-Based-Permissions (viewtopic.php?f=4&t=3498)

Post Reply