用简单的代码来实现文件上传
(编辑:jimmy 日期: 2024/11/26 浏览:3 次 )
代码如下,可以参考一下
(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();
%>
下一篇:在JSP中访问数据库大全