The getParts and getPart Methods
Servlet 3.0 supports two additional HttpServletRequest methods:
Part getPart(String name)
The request.getParts() method returns collections of all Part objects. If you have more than one input of type file, multiple Part objects are returned. Since Part objects are named, the getPart(String name) method can be used to access a particular Part. Alternatively, the getParts() method, which returns an Iterable<Part>, can be used to get an Iterator over all the Part objects.
Retrieve the name, size, and content-type of the Part
Query the headers submitted with a Part
Delete a Part
Write a Part out to disk
For example, the Part interface provides the write(String filename) method to write the file with the specified name. The file can then be saved in the directory specified with the location attribute of the @MultipartConfig annotation or, in the case of the fileupload example, in the location specified by the Destination field in the form.