A little help please - saving filenames to database

I’ve looked through the documentation and it doesn’t quite do what I want to achieve.

I have a form that has a multi file upload. I send these files to a Server Connect action that then processes them. What I want it to do, that is different to the docs, is save with a GUID and that path is saved to the database BUT I also want the original filename to be saved too so that when I use the file download function in a separate action, I can set the filename back to the original.

The problem I’m having is the in the repeat step that cycles through the upload, the name binding is the GUID set in ‘file upload’ and not the original one so I can’t see how to access it to then save it in the DB.

File upload:

With a Database Insert step that uses the name property from the repeat
image

Hi,
haven’t actually ever used the multiupload but try this.
The idea of saving with GUID is that you are overwrite original file name.
The original file name is actualy held in the post variable that you are sending from the form.
So try this

  1. Save the GUID name in a column
  2. Save the $POST value of the file in another column

This way you will have both names in your database.

Hope it helps and it works.

Thank you!

2 Likes

The filename of the uploaded file is available using {{name}}.

2 Likes

I think Jon means

{name}

assuming we are talking about the template field.

3 Likes

Aah, I was thinking it was in the insert query.

3 Likes

Yep, you’re correct. Ben wants to store the original filename, but use guid for the physical file.

3 Likes

Thanks all,
If there are multiple files how do you get the matching name property from $_POST? Will the repeat $index of the file upload always match the $_POST file’s array index?

i.e. would something like this work in the repeat?

{{$_POST.att[$index].name}}

‘att’ is the name of the file input