The Servlet and JSP specifications does not provide us with any special feature to handle multipart requests (file uploads).
However,we can use third party libraries or make their own framework for this.Writing our own code to handle this is just like re-inventing the wheel. As Freddy Wong suggested we can use package at http://commons.apache.org/fileupload/.
But somehow it comes to my mind, what if we use PUT method?
If you just want a file name, you can make the input field of type "text", and have the user enter the file name. Also, I would question the request not to use 3rd party libraries. It's a lot of work to recreate a file upload handling library from scratch; what would be the point of that?
what if we use PUT method?
HTML forms do not support PUT (and I'm not sure how that would help, either).
It´s fine that you only need the file name and not the file contents, but realize that you can´t get the file contents in any way by only the file name. Maybe only if both the client and the server runs at physically the same machine, but certainly not another than that.
subject: request.getParameter("fileName") returning null in post method of servlet . Why?