Adding Several Attached Files

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

Adding Several Attached Files

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

Hello!

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!

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1156
Joined: 2019-05-21 22:42
Location: Germany
Contact:

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 1339 times
and
unlimited_images_ver001.png
unlimited_images_ver001.png (22.42 KiB) Viewed 1339 times

Olaf

Post Reply