2 Replies Latest reply on Jun 11, 2011 10:09 PM by Michael George

    File Upload not working with getData()

    Michael George Newbie

      I was successful in getting rich:fileUpload to work with getFile(), but I would prefer (for security reasons) to use the getData() method instead of getFile() . I've tested and verified in a mini-project that the createTempFiles param is set to FALSE (and removed the tempFilesDirectory param) inside web.xml. However, event.getUploadItem().getData() is returned as null. I did notice too that the isTempFile() call remains TRUE regardless of how I set my web.xml context param (i.e. either true/false has no effect on the isTempFile() property). Here's what my code looks like...



      <rich:fileUpload fileUploadListener="#{myAppView.fileUploadListener}"




          acceptedTypes="jpg, gif, png, bmp" allowFlash="false">




      Back End Bean

      public void fileUploadListener(UploadEvent event) throws Exception {

      log.info("INSIDE fileUploadListener - " + event.getUploadItem()..getData() + " | " + event.getUploadItem().isTempFile());




      INSIDE fileUploadListener - null | false








      Is setting the createTempFiles context param inside web.xml to false not the correct way to retrieve a populated getData() property (where isTempFile() returns as false)?


      How do I configure my web app to successfully use the event.getUploadedItem().getData() method?


      Any help would be greatly appreciated. Thanks.



      Using: JSF 1.2, Facelets 1.1.14, RichFaces 3.3.3, Win XP 32 and Win 7 64-bit, IE and FF, Eclipse Helios, Tomcat 6, Java 1.6