title: Before Upload event in PrimeFaces 3.5
body: <p>Is it possible to do some server side processing, before file upload in PrimeFaces 3.5? Let say the form contains some <code>p:inputText</code> elements, which needs to be filled before file upload, So how can I check that? Any event?</p>
  
  <p>View looks like-</p>
  
  <pre><code>&lt;h:form enctype="multipart/form-data"&gt;
      &lt;p:inputText value="#{fileUploadController.name}" id="name" label="Name" /&gt;
      &lt;p:inputText value="#{fileUploadController.about}" id="about" label="About" /&gt;
      &lt;p:fileUpload fileUploadListener="#{fileUploadController.handleFileUpload}"
              mode="advanced" 
              update="messages"
              sizeLimit="100000" 
              allowTypes="/(\.|\/)(gif|jpe?g|png)$/"/&gt;
  
      &lt;p:growl id="messages" showDetail="true"/&gt;
  
  &lt;/h:form&gt;
  </code></pre>
  
  <p>ManagedBean is below-</p>
  
  <pre><code>import javax.faces.application.FacesMessage;
  import javax.faces.context.FacesContext;
  
  import org.primefaces.event.FileUploadEvent;
  import org.primefaces.model.UploadedFile;
  
  public class FileUploadController {
  
      private String name;
      private String about;
      //Getters &amp; Setters
  
      public void beforeUpload(){
      if(getName().isEmpty()||getAbout().isEmpty())
          FacesMessage msg = new FacesMessage("Error", "Name or About cannot be empty");
          FacesContext.getCurrentInstance().addMessage(null, msg);
      }
  
      public void handleFileUpload(FileUploadEvent event) {
          FacesMessage msg = new FacesMessage("Succesful", event.getFile().getFileName() + " is uploaded.");
          FacesContext.getCurrentInstance().addMessage(null, msg);
      }
  }
  </code></pre>