Multiple Uploads

Different Names

If a multipart request supplies multiple uploads that each have a different part name, simply create an argument to your route that receives each part. For example:

  1. HttpResponse upload(String title, String name)

A route method signature like the above will expect 2 different parts with the names “title” and “name”.

Same Name

To handle receiving multiple parts with the same part name, the argument must be a Publisher. When used in one of the following ways, the publisher will emit one item per part found with the specified name. The publisher must accept one of the following types:

For example:

  1. HttpResponse upload(Publisher<StreamingFileUpload> files)
  2. HttpResponse upload(Publisher<CompletedFileUpload> files)
  3. HttpResponse upload(Publisher<MyObject> files)
  4. HttpResponse upload(Publisher<Publisher<PartData>> files)
  5. HttpResponse upload(Publisher<CompletedPart> attributes)