Uploading file to the server using JSP
There are many ways to upload the file to the server. One of the way is by the MultipartRequest class. For using this class you need to have the cos.jar file. In this example, we are providing the cos.jar file alongwith the code.
Commonly used Constructors of MultipartRequest class
Example of File Upload in JSP
In this example, we are creating two files only, index.jsp and fileupload.jsp.
To upload the file to the server, there are two requirements:
We are uploading the incoming file to the location d:/new, you can specify your location here.
If size of the file is greater than 1MB, you should specify the post size.