5 Replies Latest reply on Feb 16, 2008 4:51 PM by Kai Muller

    <s:fileUpload> problem on Internet Explorer

    Kai Muller Newbie

      Are there any known problems with uploading files in Seam 2.0.1.GA?

      On Firefox all's working fine (I followed the 5 part tutorial in Seam Wiki), but on Internet Explorer 6... nothing happens when pressing the Upload button - other functionalities work fine in IE.



        • 1. Re: <s:fileUpload> problem on Internet Explorer
          Shane Bryzak Master

          I just tested the seam-space example from latest SVN on IE 6, IE 7 and Firefox. File upload (which is used in the new user registration views) worked fine on all three browsers.

          • 2. Re: <s:fileUpload> problem on Internet Explorer
            Kai Muller Newbie

            Shane, thanks for your effort!

            I have to test this in a different way. The seam-space example from Seam 2.0.1.GA doesn't work in my Internet Explorer 6 neither. Do you just have an idea which of the thousands of configuration possibilities of IE is maybe disabled/enabled? I thought I had the default setting because I don't use IE ;-)

            --

            By the way: I tried to install the example with "ant tomcat.deploy" in Tomcat, but at start up I get the message:

            Error listenerStart
            Context [/jbosss-seam-space] startup failed due to previous errors

            I will not look into this further, it's just fyi.

            • 3. Re: <s:fileUpload> problem on Internet Explorer
              Shane Bryzak Master

              I don't really know why it's not working in your IE6. Do you get any script errors? Is it possible for you to try it on another machine with IE6?

              • 4. Re: <s:fileUpload> problem on Internet Explorer
                Kai Muller Newbie

                I tried it now out on two other PCs with IE6 and Firefox. It doesn't work on IE6 and Firefox 1.0, neither for my application nor for the seamspace example from 2.0.1.GA. On Firefox 2 it's ok.

                There are no script errors.

                This is my xhtml:

                <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                <ui:composition xmlns="http://www.w3.org/1999/xhtml"
                 xmlns:s="http://jboss.com/products/seam/taglib"
                 xmlns:ui="http://java.sun.com/jsf/facelets"
                 xmlns:f="http://java.sun.com/jsf/core"
                 xmlns:h="http://java.sun.com/jsf/html"
                 xmlns:j4j="http://javascript4jsf.dev.java.net/"
                 xmlns:rich="http://richfaces.ajax4jsf.org/rich"
                 template="layout/template.xhtml">
                
                <ui:define name="body">
                
                 <s:div rendered="#{s:hasRole('UserRoleAuthorizedUser')}">
                
                 <h:messages styleClass="message" globalOnly="true"/>
                
                 <h:form id="uploadArtwork" enctype="multipart/form-data">
                
                 <rich:panel>
                 <f:facet name="header">#{messages['UploadImage']}</f:facet>
                 <div class="dialog">
                 <s:validateAll>
                 <h:panelGrid columns="2" rowClasses="prop" columnClasses="name,value">
                
                 <h:outputLabel for="artwork">#{messages['SelectImage']}</h:outputLabel>
                 <s:decorate>
                 <s:fileUpload id="artwork" styleClass="input-field"
                 data="#{uploadService.data}" accept="images/jpg,images/gif,images/png"
                 contentType="#{uploadService.contentType}"
                 fileName="#{uploadService.fileName}" fileSize="#{uploadService.size}"
                 size="40" maxlength="40" required="true"/>
                 <j4j:idProxy id="_focus"/>
                 </s:decorate>
                
                 </h:panelGrid>
                 </s:validateAll>
                 </div>
                 </rich:panel>
                
                 <div class="actionButtons">
                 <h:commandButton id="uploadButton" value="#{messages['Upload']}"
                 action="#{uploadService.upload}"/>
                 </div>
                
                
                 </h:form>
                 </s:div>
                 </ui:define>
                </ui:composition>
                


                and the components.xml part:

                 <component class="org.jboss.seam.web.MultipartFilter">
                 <property name="createTempFiles">true</property>
                 <property name="maxRequestSize">500000</property>
                 <property name="url-pattern">*.seam</property>
                 </component>
                


                Do other users have experience with file uploading on IE? Are there other alternatives to <s:fileUpload>?

                ----
                To test it on other machines I first had to jump over two traps. Maybe it's useful to know for other users:
                1. From Tomcat I was used to have access to my server over the network by http://192.168.0.4/myproject/. For JBoss it is different. For security reasons the default host is 127.0.0.1.
                You have to start JBoss with the -b option from the console "run -b 192.168.0.4". (I had to start it from console because in Eclipse 3.3 a changed server address had no effect.)
                2. Pay attention to the JDK versions. My JBoss had 1.5, my Eclipse 1.6 ...

                • 5. Re: <s:fileUpload> problem on Internet Explorer
                  Kai Muller Newbie

                  I finally found out the reason why I had the problems in my application with IE6.

                  First, I added a <rich:calendar> tag inside the <h:form enctype="multipart/form-data"> in my xhtml. In the code above I removed this tag to shorten the code.... the result was a form in a form. Firefox can handle this, IE not. Silly error.

                  Second, the Seam Wiki example contains in its third part
                  http://linuxbeans.blogspot.com/2007/10/image-handling-in-seam-apps-part-iii.html a scale() method with

                  ...
                   String formatName = "";
                   if ("image/png".equals(contentType))
                   formatName = "png";
                   else if ("image/jpeg".equals(contentType))
                   formatName = "jpeg";
                  ...
                  
                  

                  - but: the contentType in Firefox was "image/png" and "image/jpeg", but in IE it is "image/x-png" resp. "image/pjpeg" for my example images.

                  Summary: <s:fileUpload> is ok, also for IE6.