0

enter image description here

Here we will get multiple images so we will have to store all the images under this folder. This is the code i am trying but its not working.

    for (Part part : request.getParts()) {
                String fileName = filePart.getSubmittedFileName();
                part.write("src/main/webapp/WEB-INF/adimages/" + fileName);
                inputStream=part.getInputStream();
            }
    
anoopKumar
  • 19
  • 5
  • That wouldn't be the right path. Do `request.getSession().getServletContext().getRealPath("/");` then you know where to place your target directory – g00se May 25 '22 at 17:03
  • Its returning path :- C:\Users\anoopKumar\eclipse-workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\testFileUpload\ .. Which not something i am looking for – anoopKumar May 26 '22 at 05:48
  • Ha. that's a perfect illustration of why I use a real server in my config when building webapps. you're going to need a real directory to which you can write. – g00se May 26 '22 at 08:41

0 Answers0