search
Login

Categories


C Books Guide and List
C++ Books Guide and List
Best Java Books

3.8k questions

4k answers

117 comments

10.7k users

0 votes
25 views
asked Guru 27.1k points 31 50 97

2 Answers

0 votes
To browse and select a file for upload you need a HTML <input type="file"> field in the form.

As stated in the HTML specification you have to use the POST method and the enctype attribute of the

form has to be set to "multipart/form-data".

<form action="upload" method="post" enctype="multipart/form-data">
    <input type="text" name="description" />
    <input type="file" name="file" />
    <input type="submit" />
</form>
After submitting such a form, the binary multipart form data is available in the request body in a different format than when the enctype isn't set.
Before Servlet 3.0, the Servlet API didn't natively support multipart/form-data. It supports only the
default form enctype of application/x-www-form-urlencoded. The request.getParameter() and consorts
would all return null when using multipart form data.
answered Geek 15.3k points 16 41 63
0 votes
You need the common-io.1.4.jar file to be included in your lib directory, or if you're working in any  editor, like NetBeans, then you need to go to project properties and just add the JAR file and you will  be done.
 
To get the common.io.jar file just google it or just go to the Apache Tomcat website where you get the  option for a free download of this file. But remember one thing: download the binary ZIP file if you're  a Windows user.
 
 
 
answered Guru 24.6k points 29 52 81

Related questions

0 votes
1 answer 14 views
14 views
asked sara Guru 24.6k points 29 52 81
0 votes
1 answer 127 views
0 votes
2 answers 53 views
53 views
asked john Guru 27.1k points 31 50 97
0 votes
1 answer 22 views
22 views
asked smith Geek 15.3k points 16 41 63
0 votes
1 answer 16 views
16 views
asked sara Guru 24.6k points 29 52 81
...