code: private File writeFile(final FormFile fileItem) throws Exception {
  		final String directory = this.getFileDir(fileItem.getContentType());
  
  		// TODO: ensure unique file names
  		final File file = new File(directory + System.currentTimeMillis() + "-"
  				+ fileItem.getOriginalFileName());
  		fileItem.getFormItem().write(file);
  		return file;
  	}
docs: write a file to the directory matching its content type
  
  @param fileItem
  form file
  @return instance of the file written
  @throws Exception
  if the file could not be written