struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paranoid_Fabio <paranoid_fa...@yahoo.it>
Subject Re: Form with upload
Date Sat, 16 Feb 2008 18:26:45 GMT

ok. I've understood. Thank you very much


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-tp15517551p15518630.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message