Hi Sneha --
I'm using FileBean to upload an image and save it to disk.
My action has a FileBean attribute (called image) w/ getter and setter. In
my action, I make sure the file isn't null and then after creating a path to
where I want it (imgPath), I just call:
image.save(new File(imgPath));
That's it (for me)!
Sneha Manohar wrote:
>
> Hi All,
> Thanks for your previous help . I wish to upload image in from JSP & store
> it on local disk .
> Can I use FileBean for uploading images. I need some help in this
> direction.
>
> I tried doing something like this ..
>
> profile.jsp
>
> <stripes:form action="Register.action">
> <td class="c0">Image profile:</td>
> <td class="c1">
> <stripes:file name="newIamge"/>
> </td>
> <stripes:submit class="btnProfile" name="modify" value="Modify" /></td>
>
> In the RegisterActionBean ,I say
> File f= new File("c:\user");
> public Resolution modify(){
> setUser(this.user);
> if(this.getNewImage() != null){
> try{
> System.out.println("Inside the modify");
> newImage.save(newFile);
> System.out.println("after the modify");
> }catch(IOException io){
> io.printStackTrace();
> }
> }else{
> System.out.println("Inside else"+this.getNewImage());
> }
>
> This does not work...I get this.getNewImage()) as null
>
> Thanks
> sneha
>
>
> Did you know? You can CHAT without downloading messenger. Go to
> http://in.webmessenger.yahoo.com/
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Stripes-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
>
--
View this message in context:
http://www.nabble.com/Upload-image-tp22806806p22818350.html
Sent from the stripes-users mailing list archive at Nabble.com.
------------------------------------------------------------------------------
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users