Possible Duplicate:
How to upload files in JSP/Servlet?
I have to pass a text file as input in jsp file and read the contents of a file in servlet. I don't know which method to use in servlet to read the file. For example to read a text input we use request.getParamater() method in servlet. I don't know how to read a file input.In jsp I have the following code
<form action="load" method="post" enctype="multipart/form-data">
Select a file to upload:<input type="file" name="filename" size="20"/><br><br>
<input type="submit" value="Upload File"/>
</form>
How to get the file in servlet and read the contents?