// temporary form item scope. The file must be moved later using the
// moveUploadFileTo() method to the final destination.
tempUploadFile = new File(WebappHelper.getUserDataRoot() + "/tmp/" + CodeHelper.getGlobalForeverUniqueID());
File tmpRequestFile = getRootForm().getRequestMultipartFile(component.getFormDispatchId());
// Move file to internal temp location
boolean success = tmpRequestFile.renameTo(tempUploadFile);
if (!success) {
// try to move file by copying it, command above might fail
// when source and target are on different volumes
FileUtils.copyFileToFile(tmpRequestFile, tempUploadFile, true);
}