2 Replies Latest reply on Apr 13, 2007 4:05 AM by Lars Rønning

    help on s:fileUpload

    Tong Wang Newbie

      Seam version 1.2.1.

      I am always getting NULL value for the upload file. I tried using both InputStream and byte[]; I also tried putting the upload file property in a SLSB and a class that extends EntityHome, but neither worked. Anyway here is my code:

       <h:form enctype="multipart/form-data">
       <rich:togglePanel id="importFeeds" switchType="ajax" stateOrder="closed, import">
       <f:facet name="closed">
       <h:panelGrid columns="1">
       <rich:toggleControl for="importFeeds" value="Import Feeds &#187;" />
       <f:facet name="import">
       <h:panelGrid columns="1">
       <s:fileUpload data="#{widgetHome.feedDefFile}" />
       <s:button id="importFeed" value="Import..." action="#{widgetHome.importFeeds}"/>
       <rich:toggleControl for="importFeeds" value="&#171; Close Import" />

      public class WidgetHome extends EntityHome<Widget> {
       .... // other methods
       private Log log;
       // No matter whether it's byte[] or InputStream, it's always null
       private byte[] feedDefFile;
       //private InputStream feedDefFile;
       public void importFeeds() {
       // I get an NPE exception on this, because feedDefFile is always null
       log.info("feedDefFile.length = " + feedDefFile.length);