File Upload and Multipart Form-Data.

HTML can be used to upload a file from the browser to the server if the ENCTYPE of the form is multipart/form-data and have an INPUT TYPE=FILE element. Servlets may use the class com.mortbay.HTTP.MultiPartRequest to decode the input from such forms.

The following form will upload a text file to a servlet that counts the number of lines in the file. The source of the servlet is listed below.

Text File: