Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Upload Multiple Images using formfile in JSP Sturts

 
florencia dwinta
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In Form Class :




In Handler Class:



In JSP Class:



Method writeImageToFile:




for your information, my input form is dynamic base on listQuestion, if listQuestion have three images then in screen will be show three input file and if listQuestion have five images then in screen will be show five input file.

my problem is listQuestion have five images, when i'm submit the form, five images can uploaded on server n database but first image until fifth image is same. (all images is same with lastest image choosed) .
i know my mistake is in the attribute of class form (attribute image) but i'm confused how to make the all images can saved on list or array then when i try upload that image, i'm just iterate the list of image.

could you help me, what should i do?


regards,

Florencia.
 
Shankar Tanikella
Ranch Hand
Posts: 329
Eclipse IDE Java Oracle
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Florencia,
You are right, there is a definite problem with the form. What we are having here is a list of FormFiles and we are just having one place holder for it. What we are doing above is we iterate the same FormFile and hence it takes the last assignment. Either we need to have a array of FormFile's and we need to do index it int the JSP. Have you seen this thread with (supposed to be) working solution
 
florencia dwinta
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Morning Shankar,

Your link really helped me to fix my program

Thank you....
 
Shankar Tanikella
Ranch Hand
Posts: 329
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's good news!!!
Worth closing the resolved threads which would be useful for others while doing a search
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic