About Pankaj Kumar
File Upload and Download and common tasks in a java web application. Since I have written a lot about java servlet recently, I thought to provide a sample example of file upload and download using servlet.
Use Case
Our use case is to provide a simple HTML page where client can select a local file to be uploaded to server. On submission of request to upload the file, our servlet program will upload the file into a directory in the server and then provide the URL through which user can download the file. For security reason, user will not be provided direct URL for downloading the file, rather they will be given a link to download the file and our servlet will process the request and send the file to user.
We will create a dynamic web project in Eclipse and the project structure will look like below image.
Source : http://www.javacodegeeks.com/2013/08/servlet-upload-file-and-download-file-example.html