Form Based File Upload Servlet

The purpose of this assignment was to:

Important about Uploading Files with HTML Form

It's important to use multipart/form-data as encode type for the HTML form and file as value for the type attribute in the input tags.

It's also important to code the servlet not to allow too big file sizes since the POST- method allows for sending an unlimited amount of data, which of course could be misused.

Assignment Description

Create a HTML document with a HTML form that have functionality for uploading files.

Code the servlet that retreive files and - if the mime-type(content type) is text/plain, image/jpeg or image/x-png - sends back the file content.

If the mime-type is none of the mentioned the servlet should send back information about the filename, mime-type and file size.

My Solution, Assignment Files

Try the File Upload Servlet

«  Previous Next  »