NewLearner
NewLearner

Reputation: 116

Form is not submitted during FileUpload

I want to upload a file into my Weblogic server. My form is

 <h:form id="manualReplay" enctype="multipart/form-data">

<h:outputText value="UploadFile Here" /> :
    <h:panelGroup layout="block" class="output">
    <t:inputFileUpload value="#{serviceClass.uploadedFile}"/>
    </h:panelGroup>                                     
    <h:commandButton id="upload" value="upload" action="upload" />

</h:form>

My spring web flow Flow xml File

<view-state id="manualReplay" model="serviceClass" >    
   <transition on="upload" to="manualReplay">
       <evaluate expression="serviceClass.submit()"/>
   </transition>
</view-state>

My Bean Class

private UploadedFile uploadedFile;

public void submit() throws IOException {

    String fileName = FilenameUtils.getName(uploadedFile.getName());
    String contentType = uploadedFile.getContentType();
    byte[] bytes = uploadedFile.getBytes();
    }

public UploadedFile getUploadedFile() {
    return uploadedFile;
}

public void setUploadedFile(UploadedFile uploadedFile) {
    this.uploadedFile = uploadedFile;
}

But when the form is being submitted the page is just reloading without any errors. Any ideas where i'm wrong. When i remove the enctype this is working fine, but only for multipart/form-data it is happening!

Upvotes: 0

Views: 370

Answers (1)

Prasad
Prasad

Reputation: 3795

If you are using SWF, then you need to include CommonsMultipartResolver in your config file:

    <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"> 
           <property name="maxUploadSize" value="1024" />//Set your file size limit here
    </bean>[enter link description here][1]

Upvotes: 1

Related Questions