public CommonsMultipartFile(org.apache.commons.fileupload.FileItem fileItem)
Create an instance wrapping the given FileItem.
fileItem - the FileItem to wrap
public final org.apache.commons.fileupload.FileItem getFileItem()
Return the underlying org.apache.commons.fileupload.FileItem
instance. There is hardly any need to access this.
public void setPreserveFilename(boolean preserveFilename)
Set whether to preserve the filename as sent by the client, not stripping off
path information in getOriginalFilename().
Default is "false", stripping off path information that may prefix the
actual filename e.g. from Opera. Switch this to "true" for preserving the
client-specified filename as-is, including potential path separators.
Transfer the received file to the given destination file.
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 target file has been moved in the filesystem, this operation
cannot be invoked again afterwards. Therefore, call this method just once
in order to work with any storage mechanism.
NOTE: Depending on the underlying provider, temporary storage
may be container-dependent, including the base directory for relative
destinations specified here (e.g. with Servlet 3.0 multipart handling).
For absolute destinations, the target file may get renamed/moved from its
temporary location or newly copied, even if a temporary copy already exists.