jsp的文件怎么上传

1.文件上传:
有关jsp的文件上传,我们需要导一个叫jspsmartupload.jar的包。
例 1.1.1
upload.jsp:
<%@ page contentType="text/html; charset=GBK" %>
<html>
<body>
<h1>
<%
if(request.getParameter("i")!=null)
{
out.print("上传了"+request.getParameter("i")+"个文件");
}
%>
</h1>
we must use post, otheriwse, report negativeArray error.
<form method="post" action="ServletHello2" enctype="multipart/form-data">
<br>
<input  type="text" name="user" value="可以中文"/>
<!--the following name does not matter.-->
<input  type="file" name="upload"/>
<input  type="file" name="upload1"/>
<br>
<input type="submit" name="Submit" value="Submit">
<input type="reset" value="Reset">
</form>
</body>
</html>

package com;
import javax.servlet.*;
import javax.servlet.http.*;
import com.jspsmart.upload.SmartUpload;
import com.jspsmart.upload.SmartUploadException;

  多请见:http://www.mark-to-win.com/index.html?content=Jsp/jspUrl.html&chapter=Jsp/jsp8_web.html#upload

发布了0 篇原创文章 · 获赞 0 · 访问量 681

猜你喜欢

转载自blog.csdn.net/qq_44638460/article/details/104157814
今日推荐