Thank you. If I submit all the data in "one shot" everything goes ok.

What I wanted to do in principle was to first upload the image (and other
files the user has to upload), then submit the form with other parameters.
like a step-by-step submission.
The problem is that i would like to have, in the end, all the data (image,
files, paramaters) available in the same action.. so what I thought to do is
to call different methods of the same action class via different action
names in struts.xml, each declaring a different <method> parameter..but I
guess I'm doing something wrong.


Paranoid_Fabio wrote:
> 
> Hello. I have to implement a file upload. Togheter with it, the user have
> to fill a form.
> The form is like:
> 
> 
>          title
>          price
>          image
> 
> The user should fill the "title" and "price" field, upload an image and
> then, clicking a submit button, send the form parameters to the action. So
> what I need is to do upload the file first and to store the File object in
> the action. Then clicking submit all the other form parameters should be
> sent to the same action.
> 
> I tried defining two different methods in the same action: execute() that
> is the method called when the "submit" button of the form is clicked and
> uploadImage() that is the method that should be called only to upload the
> image. But I can't do these because if I specify:
> 
> <action name="ManualContentUpload"
> class="actions.contents.upload.ManualUpload">
>         <result name="success">/pages/ManualContentUpload.jsp</result>
> </action>
> 
> and:
> 
> <action name="ManualImageUpload"
> class="actions.contents.upload.ManualUpload" method="doImageUpload">
>         <result name="success">/pages/ManualContentUpload.jsp</result>
>         <result name="input">/pages/ManualContentUpload.jsp</result>
> </action>
> 
> (the same action class with doImageUpload() executed instead of execute())
> 
> And then in JSP
> 
> <form action=ManualImageUpload  method="POST"
> enctype="multipart/form-data">
>      <input type="file" name="image" title="upload image"/>
>      <input type="submit"/>
>  </form>      
> 
> it does not work. And the same thing if I create another action (action
> name and class) and use it to upload only the image like that:
> 
> <form action=imageUploadAction  method="POST"
> enctype="multipart/form-data">
>      <input type="file" name="image" title="upload image"/>
>      <input type="submit"/>
>  </form>      
> 
> where imageUploadAction is a regular action (different from the one called
> to display current jsp)
> 
> <action name=imageUploadAction"
> class="actions.contents.upload.ImageUpload"> 
>         <result name="success">/pages/ManualContentUpload.jsp</result>
>         <result name="input">/pages/ManualContentUpload.jsp</result>
> </action>
> 
> Anyone can help me? thank you very much in advance.
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Form-with-upload-tp15517551p15518224.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to