I would highly recommend reading the following article
Upload file bean The main points are:
Client-Side
-----------
* form must be of enctype multipart/form-data
* use the <INPUT type="file"> element for file upload
Server-Side
-----------
*
Servlets cannot handle multipart/form-data, so need to write own code to handle the stream (the article gives sample code)
* Once you have extracted the file from the servlet input stream, you can write to database
You may also like to check out the following article
Filter code for Servlet 2.3 which describes how you can use a file upload filter which overrides the getParameter() methods to be able to get file parameters.
The articles are quite explanatory, and you can either write your code adapted from the articles, or use the com.oreilly.servlet.* package which already implements most of this functionality.