I have added enctype to the form tag----------
<h:form id="styleForm" enctype="multipart/form-data" >
I have also added Extensions filter in web.xml---------
<!-- Extensions Filter -->
<filter>
<filter-name>extensionsFilter</filter-name>
<filter-class>org.apache.myfaces.component.html.util.ExtensionsFilter</filter-class>
<init-param>
<param-name>uploadMaxFileSize</param-name>
<param-value>100m</param-value>
<description>Set the size limit for uploaded files.
Format: 10 - 10 bytes
10k - 10 KB
10m - 10 MB
1g - 1 GB
</description>
</init-param>
<init-param>
<param-name>uploadThresholdSize</param-name>
<param-value>100k</param-value>
<description>Set the threshold size - files
below this limit are stored in memory, files above
this limit are stored on disk.
Format: 10 - 10 bytes
10k - 10 KB
10m - 10 MB
1g - 1 GB
</description>
</init-param>
<init-param>
<param-name>uploadRepositoryPath</param-name>
<param-value>/temp</param-value>
<description>Set the path where the intermediary files will be
stored.
</description>
</init-param>
</filter>
<filter-mapping>
<filter-name>extensionsFilter</filter-name>
<url-pattern>*.jsf</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>extensionsFilter</filter-name>
<url-pattern>/faces/*</url-pattern>
</filter-mapping>
Regards,
Rashmi
Matthias
Wessendorf To: MyFaces Discussion
<[email protected]>
<[EMAIL PROTECTED] cc:
mail.com> Subject: Re: File upload problem
06/29/2005
05:06 PM
Please respond
to "MyFaces
Discussion"
have you configured the extension filter
and added enctype to <h:form> ?
-Matthias
On 6/29/05, Rashmi Kumari <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I have added File upload component in my application. User selects the
> image and can see the preview of it as it is happening in myfaces
examples.
> I have a save button also for calling the action but form is not getting
> submitted when this button is clicked.
> If I remove the file upload tag, then the action gets invoked. what could
> be the reason for this behaviour.
>
> The jsp is:
>
> <h:outputText value="#{Message.marker_style_import}" />
> <x:inputFileUpload id="fileupload"
> accept="image/*"
> value="#{fileUploadForm.upFile}"
> storage="file"
> styleClass="fileUploadInput"
> required="true"/>
>
>
> <f:verbatim><br></f:verbatim>
> <h:commandButton value="#{Message.image_upload_button}" action="
> #{fileUploadForm.upload}" />
>
> <h:panelGrid columns="1" rendered="#{fileUploadForm.uploaded}">
> <h:outputText value="#{Message.marker_style_preview}" />
> <h:graphicImage url="fileupload_showimg.jsf" width="50" height="50"
> style="border-style: solid; border-width: 2"/>
> </h:panelGrid>
> <h:commandButton id="submit" action="#{Persister.saveStyle}" value="
> #{Message.style_submit_button}"/>
>
> But it doesn't invoke saveStyle method of the backing bean.
>
> Thanx for any suggestions.
>
> Regards,
>
> Rashmi
>
>
--
Matthias Wessendorf