I want to uplaod an image file in a database through blob object...I have a jsp page where I insert the file and when I click the submit button a servlet is called.But how would I retrieve the name of that file in the servlet ?
@Jeanne Boyarsky I had this code...Here file name is given in the servlet itself.But what I want to do is to retrieve the name of the file from the jsp page and use the following code..Why can't I do that?
You can, but you are doing it very very wrong. Please see the JSP FAQ for information on properly handing file uploads. You do not read the uploaded file information from the file system -- you can't, in fact. The server has no access to the client's file system.
You need to read the information from the multi-part request, preferably using one of the popular 3rd party libraries for doing so. Trying to do it yourself is like hitting yourself with a hammer; best not done.