The forms plugin allows us to use the save
action, which will place the form data in a file with a timestamp of our own choice within the user/data
directory. That’s fantastic. The file
input field allows us to chose a destination
, which boils down to either using @self
, meaning that the files will be saved where the page’s template.md
file is located, or to hand in a path to a directory. This is nice.
However, what I’m trying to achieve is this:
- Save the form AND its associated uploaded files in the same directory
- There should be one directory for each submitted form and it should therefore have a unique name (like the file saved by
save
does)
In other words, I would need to be able to:
- Somehow tell the
save
action to create a subdirectory with a certain format, just like we can define the timestamp/ID format for the file right now - Use that same directory name (format string) in the
destination
property for thefile
field
Is this possible? Is there any other way to achieve the desired result? Or will I have to create/modify a plugin?
EDIT: Alternatively, is there any other way to associate an uploaded form with the files uploaded through it, so other scripts can later make that connection and show the form data and the uploaded files for a given submission?