I need some help with a form with file uploads

Just hoping for a little assistance, I think I have confused myself.

What I need
Upload an image file, however with a custom name, rather than the name of the uploaded .jpg file, and for the full path of the file including its new name to be stored in my database as a new row.

The above is pretty easy with having a form with a text input and an upload field, upon submit of the form, the server action runs.

The POST variables are my
text_input
file_field

The Steps are
Database Connection
File Upload > Name: upload1, Upload Fields: {{$_POST.file_field}}, Template: {{$_POST.text_input}}
Database Insert > Column: img_url, Type: text, Value: {{upload1.path}}

So far this works great, but thats for 1 file, now I need to allow upload of many files, because each file needs a custom name, i can not use a dropzone component, nor can i just turn my upload field into a multi file field.
I specifically need a Text Input with a File Upload field per image, and the client needs to use something like a select, or a number counter, or checkboxes, I dont really mind how to set how many images they will upload, and for the page to give enough Text Inputs with relative File Upload fields to match what they are wanting to upload.
Once they have selected all their files and named all the images, they hit submit, all files get uploaded with their new names, and each path gets stored in the database table as a single row per file.

I am really unsure how to set this up, and have failed at it a number of times, Tried a Client Side repeat, which i sort of had working but could not get the server side structure figured out in my head.

Any suggestions, examples, would be most welcomed.

Hello Paul,
Use the multi insert server action step and then generate your form using the form generator.
You can use a select input as a repeat region expression on the page.

1 Like

Thanks Teo, will give it a try, I seem to recall you have a video somewhere where you used a select to give you mare records to add, but i searched for a while and just could not locate it, any chance you know where that video might be, or have i gone crazy and imagined you had a video with something similar.

EDIT:
I found it, I was not going crazy, lol. https://www.youtube.com/watch?v=RP0geVuw3Go

I am still not getting this working.

Because I need to access the path property of the image upload and the image upload step is in the repeat am i possibly meant to add a repeat inside the repeat.

Up to here, its working great


The images are all being renamed as I want and uploaded to the correct folder on the server.

Now I want to store the path, inclusive of name, into a column on the database. I have tried adding the database insert step after the upload like this. But no Upload Path still, I have tried turning output on for the repeat and the upload and still no path parameter, so I am still a little stuck.

I also tried adding a second repeat step inside the first with the expression as the image and also not quite what i need.

EDIT:
I got it working
I added the DB connection, then the repeat, then the file upload inside the repeat, then a second repeat with a condition of the file upload step, then my database insert inside the second repeat, and chose my binding as the file upload step, then I just manually typed .path after it, and lo and behold it works.