title: Wicket FileUploadField and large zip uploads
body: <p>I'm using wicket to have large (~2Gb+) zip files submitted to a web application, to process the zip file I'm using the java.util.zip.* classes and I need to be able to read random entries from the zip file. So my code is something like this:</p>
  
  <pre><code>class MyForm extends Form {
      private FileUploadField fileField;
  
      MyForm(String id) {
          super(id);
          fileField = new FileUploadField("upload");
          add(fileField);
      }
  
      @Override
      protected void onSubmit() {
          FileUpload fileUpload = fileField.getFileUpload();
          File file = fileUpload.writeToTempFile();
          ZipFile zipFile = new ZipFile(file);
          // Do more stuff
      }
  }
  </code></pre>
  
  <p>As the upload is large wicket puts it in a temp file when parsing the request, but then writeToTempFile() copies it into another temp file, so I now have two copies of the file on disk. This wastes disk space, disk IO and increased the request processing time.</p>
  
  <p>I can't use ZipFileInputStream as I need to access the files in a random order. Is there a way to stop wicket duplicating the file on disk?</p>