Hi to all!
I’m facing this problem with directives and I do not know how to proceed.
I have a sequence of directive and i would like to transform them into a directive that provides to the inner the sequence of the result. Something like Future.sequence() does on a sequence of futures…
So, briefly, i have a Seq[Directive[Tuple(A,B)] and i want a Directive[Seq[Tuple(A,B)]].
Is it something possible? or i am looking at this problem from the wrong point of view?
By the way, i need something like this because i need to upload multiple files (the number of the files and the name of the fields of the form is known only at runtime), so i need to iterate the fields of the form to upload the files, and this generate a sequence of directive, incompatible with directive composition.
Can you suggest to me a better way to achieve this?
This will probably not work. Because if the files are big enough, the stream of parts of a multipart upload needs to be read in order and can only be read once.
Have you already seen the fileUploadAll directive? It buffers all uploaded files to disk and gives you random access to the uploaded files afterwards.
If the field name is not known, that’s currently difficult to achieve. I would probably copy the source code of the FileUploadDirectives and remove the fieldName filter in the storeUploadedFiles directive.