org.springframework.web.multipart
Interface MultipartFile

The file contents are either stored in memory or temporarily on disk.
In either case, the user is responsible for copying file contents to a
session-level or persistent store as and if desired. The temporary storages
will be cleared at the end of request processing.

transferTo

This may either move the file in the filesystem, copy the file in the
filesystem, or save memory-held contents to the destination file.
If the destination file already exists, it will be deleted first.

If the file has been moved in the filesystem, this operation cannot
be invoked again. Therefore, call this method just once to be able to
work with any storage mechanism.