代碼如下,可以參考一下
(resin1.2)--〉
forms.jsp
<form action="multipart.jsp" method="POST"
enctype="multipart/form-data">
<input type="file" name="file"><br>
<input type="submit">
</form>
multipart.jsp
<%
String fileName = request.getParameter("file");
FileInputStream is = new FileInputStream(fileName);
int ch;
while ((ch = is.read()) >= 0)
out.print((char) ch);
is.close();
%>