用容易的代码来完成文件上传
发表时间:2024-05-27 来源:明辉站整理相关软件相关文章人气:
[摘要]代码如下,可以参考一下(resin1.2)--〉forms.jsp<form action="multipart.jsp" method="POST" enctype="multipart/form-data">&l...
代码如下,可以参考一下
(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();
%>