title: Check whether a file has been chosen in p:fileUpload
body: <p>I'm using PrimeFaces' simple <code>fileUpload</code> and a custom submit button, something like this:</p>
  
  <pre><code>&lt;h:form enctype="multipart/form-data"&gt;
  
      &lt;p:fileUpload value="#{fileController.file}"
                    mode="simple"
                    skinSimple="true"
                    label="choose file"/&gt;
  
      &lt;p:commandButton value="upload"
                       ajax="false"
                       label="upload"
                       icon="fa fa-upload"
                       actionListener="#{fileController.upload}"/&gt;
  &lt;/h:form&gt;
  </code></pre>
  
  <p>In the backing bean, <code>file</code> is a property of type <code>UploadedFile</code>.</p>
  
  <p>Now I want to disable the <code>upload</code> button if no file is selected yet, but I fail to get the Information whether the user has selected a file or not the <code>file</code> property remains <code>null</code> until the <code>upload</code> button is clicked). I tried the <code>valueChangeListener</code> on the <code>&lt;p:fileUpload&gt;</code> component, but the event is only fired when I click the upload button (but then it's too late)</p>
  
  <p>Anyone has a suggestion?</p>