1 Reply Latest reply on Sep 3, 2007 3:05 AM by ericjava

    a:button doesn't submit file uploads in time

      There are some bugs lurking in the interaction between the ajax4jsf components and s:fileUpload. First and simplest, putting an a:support inside a s:fileUpload component doesn't do anything. Second, this code:

       <a:form id="uploadForm" enctype="multipart/form-data">
      
       <h:outputLabel for="file">Give us a file!</h:outputLabel>
      
       <s:fileUpload id="file" data="#{uploadTest.inputStream}"
       accept="image/jpeg,image/png"
       fileName="#{uploadTest.fileName}"
       contentType="#{uploadTest.contentType}" />
       <h:commandButton id="save"
       value="Do it"
       action="#{uploadTest.upload}"/>
      
       <a:commandButton action="#{uploadTest.upload}"
       value="Do it AJAX-style" reRender="uploadForm"/>
      
       </a:form>
      


      does work when the h:commandButton is used, but does not work when the a:commandButton is used. When the a:commandButton is used, the InputStream is always null (not set) so it doesn't upload

      It seems like s:fileUpload and ajax4jsf / richfaces don't cooperate.

      Can anyone suggest a work-around? Obviously what I'm trying to do is create a form that lets someone do a partial refresh with an uploaded image.