I need to check uploading file size,type and set uploaded file name to fileUpload value tag.
 I wrote simple functions for them in the uploadController and need to call them to check the file size and type.
Is there any recommended way to do this file validation ?
<h:form enctype="multipart/form-data">
  <p:growl id="messages" showDetail="true" />
  <p:fileUpload 
        // need set value after validating the file using  
           BannerUpload.isPng()
           BannerUpload.checkMaxSize()
  
        value="#{BannerUpload.file}" mode="simple" skinSimple="true" />
  <br/>
  <ui:fragment rendered="#{not empty BannerUpload.file}">
    <img src="data:image/png;base64,#{BannerUpload.imageContentsAsBase64}" alt="" />
  </ui:fragment>
  <br/>
  <p:commandButton action="#{BannerUpload.preview}" ajax="false" value="Preview" />
  <br/>
  <p:commandButton value="Submit" ajax="false" action="#{BannerUpload.upload}" disabled="false" />
</h:form> 
    