private File uploadToTmp() throws ImportException {
  if (fileFileName == null) {
    return null;
  }
  File tmpFile=dataDir.tmpFile(shortname,fileFileName);
  LOG.debug("Uploading dwc archive file for new resource " + shortname + " to "+ tmpFile.getAbsolutePath());
  InputStream input=null;
  OutputStream output=null;
  try {
    input=new FileInputStream(file);
    output=new FileOutputStream(tmpFile);
    IOUtils.copy(input,output);
    output.flush();
    LOG.debug("Uploaded file " + fileFileName + " with content-type "+ fileContentType);
  }
 catch (  IOException e) {
    LOG.error(e);
    throw new ImportException("Failed to upload file to tmp file",e);
  }
 finally {
    if (output != null) {
      IOUtils.closeQuietly(output);
    }
    if (input != null) {
      IOUtils.closeQuietly(input);
    }
  }
  return tmpFile;
}

private File uploadToTmp ( ) throws ImportException { if ( fileFileName == null ) { return null ; } File tmpFile = dataDir . tmpFile ( shortname , fileFileName ) ; LOG . debug ( "Uploading dwc archive file for new resource " + shortname + " to " + tmpFile . getAbsolutePath ( ) ) ; InputStream input = null ; OutputStream output = null ; try { input = new FileInputStream ( file ) ; output = new FileOutputStream ( tmpFile ) ; IOUtils . copy ( input , output ) ; output . flush ( ) ; LOG . debug ( "Uploaded file " + fileFileName + " with content-type " + fileContentType ) ; } catch ( IOException e ) { LOG . error ( e ) ; throw new ImportException ( "Failed to upload file to tmp file" , e ) ; } finally { if ( output != null ) { IOUtils . closeQuietly ( output ) ; } if ( input != null ) { IOUtils . closeQuietly ( input ) ; } } return tmpFile ; }
upload file to temp file .
