It uses the HTML input control name “files” to obtain the list
List<FormDataBodyPart> of uploaded files. It can then access each file as a
I’m having great difficulty figuring out how to get a Jersey client to upload the code so that the files are associated with a control names “files”. I want to write client code to upload to the server this way
(the HTML fragment before the server code hits it fine).
I can throw together code to create FileDataBodyPart for each file to upload:
List<FileDataBodyPart> bodyParts = new ArrayList<FileDataBodyPart>();
//get files to upload
File dir =
File files =
intcount = 0;
f : files)
//Create a FileDataBodyPart for each file from uploadTestDirectory. Add to a list
+ count, new File(f.getAbsolutePath()),
My question: How can I associate the “files” control so files( the
FileDataBodyPart objects) are included under a control named “files” (like my server code expects, like the HTML at the top would produce).
I can upload files with client code like the above but can’t figure out a way to associate them with a “files” control. Does this make sense?