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);
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?
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.