1 Reply Latest reply: Jul 11, 2013 2:09 AM by gimbal2 RSS

    How to pass a image file (full) path to java


      On the browser, create a filed:


      <form action="upload.htm?" enctype="multipart/form-data;charset=UTF-8" >

      <input name="img" id="img" type="file"  value="" />


      <input type="submit" />



      click the field to add a picture such as: /myTest/test.jpg


      Then on the java side:


           DiskFileItemFactory factory = new DiskFileItemFactory();

           ServletFileUpload sfu  = new ServletFileUpload(factory);


           List items = sfu.parseRequest(request);


           FileItem file = (FileItem) items.get(0);



           //Call Oracle

          ps.setBinaryStream(3, file.getInputStream(), (int) file.getSize());



      But it always failed on line: List items = sfu.parseRequest(request);

      There was no specific error, just won't allow to pass.

      What could be the cause?


        • 1. Re: How to pass a image file (full) path to java

          Solve what issue? You're only saying what you mean to achieve, you haven't given any problem description yet. What have you tried? What is stopping you from implementing this? If you have something which doesn't work, what error do you get?


          If the answer to my questions is: I don't know how to do this, then the only real "solution" is: research.