1 Reply Latest reply on Feb 28, 2011 6:28 AM by Ilya Shaikovsky

    t:inputFileUpload - Can't show error message when exceeded max file size .

    Cristian Mastrantono Newbie

      Hi guys,

       

      I'm having some trouble with the t:inputFileUpload. If I try to upload a file with less than 1MB everything goes fine, and the value change listener is invoked. But... if I choose a file greater than 1MB the browser does nothing, and nothing happens on the console (also the listener is not invoked).

       

      So, I can't handle that exceptions and even more, I can't show a custom message to the user.

       

      Any guess ??

       

       

      I have a JSP page with the following:

       

      <t:inputFileUpload id="someId" value="#{myBean.file}" storage="memory"  valueChangeListener="#{myBean.listener}" onchange="submit();" />
      

       

       

      And the following lines in web.xml  (the 1M uploadMaxFileSize is for testing purposes only)

       

      <filter-mapping>
           <filter-name>richfaces</filter-name>
           <servlet-name>Faces Servlet</servlet-name>
           <dispatcher>REQUEST</dispatcher>
           <dispatcher>FORWARD</dispatcher>
           <dispatcher>INCLUDE</dispatcher>
      </filter-mapping>
      
      <filter>
           <filter-name>MyFacesExtensionsFilter</filter-name>
           <filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
           <init-param>
                <param-name>uploadMaxFileSize</param-name>
                <param-value>1m</param-value>
           </init-param>
           <init-param> 
                <param-name>uploadThresholdSize</param-name>
                <param-value>100k</param-value>
           </init-param>
      </filter>
      
      <filter-mapping>
           <filter-name>MyFacesExtensionsFilter</filter-name>
           <servlet-name>Faces Servlet</servlet-name>
      </filter-mapping>
      
      <filter-mapping>
           <filter-name>MyFacesExtensionsFilter</filter-name>
           <url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
      </filter-mapping>
      
      <filter-mapping>
           <filter-name>MyFacesExtensionsFilter</filter-name>
           <url-pattern>*.jsf</url-pattern>
      </filter-mapping>
      
      

       

       

      Thanks in advance !!

       

      Cristian.