<%@ page language="java" import="java.util.*,java.io.*" pageEncoding="GB18030"%> <% String path = request.getContextPath(); String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "https://www.jb51.net/"; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="https://www.jb51.net/<%=basePath%>"> <title>My JSP 'AnswerFile.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <!-- <link type="text/css" href="https://www.jb51.net/styles.css"> --> </head> <body> <jsp:useBean scope="session"/> <jsp:setProperty value="C://" property="fpath"/> <% ServletInputStream in = request.getInputStream(); upload.setInputStream(in); String nam = upload.getParameter(); out.println("姓名:" + nam + "<br><br>"); long time = upload.getFileUpload(); out.println("文件上传完毕,总共耗时:" + time + "毫秒<br>"); String leixing = upload.getParameter(); out.println("文件类型:" + leixing + "<br>"); in.close(); %> <br> <div> <a href="https://www.jb51.net/index.jsp">回到首页</a> </div> </body> </html>
JSP实现快速上传文件的方法(2)
内容版权声明:除非注明,否则皆为本站原创文章。