用容易的代碼來(lái)完成文件上傳
發(fā)表時(shí)間:2024-01-19 來(lái)源:明輝站整理相關(guān)軟件相關(guān)文章人氣:
[摘要]代碼如下,可以參考一下(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();
%>