title: How to uploaded and read text file in JSF and PrimeFaces?
body: <p>I need to upload and read a text file with PrimeFaces and JSF. My question is that when I uploaded the text file, where is it stored? </p>
  
  <p>Here is my <code>.xhtml</code> file:</p>
  
  <p></p>
  
  <p></p>
  
  <pre><code>&lt;p:fileUpload value="#{send.file }" mode="simple" /&gt;
  &lt;/h:form&gt;
  &lt;p:commandButton actionListener="#{send.upload}"  value="Send" ajax="false" /&gt;
  </code></pre>
  
  <p>And Java class:</p>
  
  <pre><code>public class Send {
      private UploadedFile file;
  
      public void upload() {
          if (file != null) {
              FacesMessage msg = new FacesMessage("Succesful", file.getFileName() + " is uploaded.");
              FacesContext.getCurrentInstance().addMessage(null, msg);
          }
  }
  </code></pre>
  
  <p>I also found this example to read the file:</p>
  
  <pre><code>import java.io.BufferedReader;
  import java.io.FileReader;
  import java.io.IOException;
  
  public class BufferedReaderExample {
  
      public static void main(String[] args) {
  
          try (BufferedReader br = new BufferedReader(new FileReader("C:\\testing.txt")))
          {
              String sCurrentLine;
  
              while ((sCurrentLine = br.readLine()) != null) {
                  System.out.println(sCurrentLine);
              }
  
          } catch (IOException e) {
              e.printStackTrace();
          }
      }
  }
  </code></pre>
  
  <p>My other question is in this example <code>"C:\\testing.txt"</code> is given as a path? Which address I must give to read my uploaded file?</p>