• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Upload Multiple Images using formfile in JSP Sturts

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 329
Eclipse IDE Oracle Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's good news!!!
Worth closing the resolved threads which would be useful for others while doing a search
reply
    Bookmark Topic Watch Topic
  • New Topic