title: Uploaded image only available after refreshing the page
body: <p>When I upload a picture, the file is successfully saved and the path is successfully set. But the uploaded image is not displayed immediately after the form submit. Only when I reload the page, the uploaded image is displayed.</p>
  
  <p>I'm saving the uploaded file as below:</p>
  
  <pre><code>InputStream is;
  try {
      File file = new File("C:\\****\\*****\\Documents\\NetBeansProjects\\EventsCalendary\\web\\resources\\images\\uploadPhoto.png");
      is = event.getFile().getInputstream();
      OutputStream os = new FileOutputStream(file);
      setUserPhoto("\\EventsCalendary\\resources\\images\\"+file.getName());   
      byte buf[] = new byte[1024];
      int len;
      while ((len = is.read(buf)) &gt; 0) {
          os.write(buf, 0, len);
      }
      os.close();
      is.close();
  
  } catch (IOException ex) {
      System.out.println(ex.getStackTrace());
  }
  </code></pre>
  
  <p>Why is the uploaded image only displayed after reloading the page and how can I solve this?</p>