用简单的代码来实现文件上传
(编辑:jimmy 日期: 2024/12/27 浏览:2)
代码如下,可以参考一下
(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();
%>