title: Convert UploadedFile (primefaces) to FileObject (Apache Common)
body: <p>I'm uploading a file using primefaces components.</p>
  
  <pre><code>   public void handleFileUpload(FileUploadEvent event) {
        UploadedFile file = event.getFile();
     }
  </code></pre>
  
  <p>For the further progress of the application, I have a function given from a library that I have to use. This function is only accepting a FileObject as input parameter.</p>
  
  <p>How can I convert the UploadedFile (primefaces) to a FileObject (Apache Common)?</p>
  
  <p>A workaround would be converting the UploadedFile to a File and then convert the file to a FileObject using <code>VFS.getManager()</code> and its functions. But to do this, I would have to save the file on the server and delete it later again.</p>
  
  <p>I'm looking for a way, where I can convert the UploadedFile directly to a FileObject. Maybe by converting it to a bytearray first?</p>
  
  <p>Glad for all suggestions.</p>