Skip to Content
Former Member
Jan 18, 2006 at 07:10 PM

How to access request content using MultipartMessage Object


I want to take a file from the Client and upload it as a FileInputStream on the server.

I have a simple form as follows:

<form action="scan" name="scan_files" method="post"
<input type="file" name="file1">
<input type="file" name"file2"/>
<input type="Submit" name="insert_scaned" value="Upload"/>

In my servlet I tried to use the

class to parse the form information.

protected void doPost(
HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
MultipartMessage multipartMsg = 

if (multipartMsg != null) {

The help said that once this is done the form information should be accessible via the

request getParameter() method. However, I can't seem to get it working?

How can I access the file so that I can parse it into a FileInputStream?