WebRoot/admin/download.jsp

(完整代码) 1KB

<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>My JSP 'index.jsp' starting page</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	</head>
	<body >
		<%
			java.io.BufferedInputStream bis = null;
			java.io.BufferedOutputStream bos = null;
			try {
				String filename = request.getParameter("filename");
				filename = new String(filename.getBytes("iso8859-1"), "utf-8");
				System.out.println(filename);
				response.setContentType("application/x-msdownload");
				response.setHeader("Content-disposition",
						"attachment; filename="
								+ new String(filename.getBytes("gb2312"),
										"iso8859-1"));
				bis = new java.io.BufferedInputStream(
						new java.io.FileInputStream(config.getServletContext()
								.getRealPath("upload/" + filename)));

				bos = new java.io.BufferedOutputStream(response
						.getOutputStream());
				byte[] buff = new byte[2048];
				int bytesRead;
				while (-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
					bos.write(buff, 0, bytesRead);
				}
			} catch (Exception e) {
				
			} finally {
				if (bis != null)
					bis.close();
				if (bos != null)
					bos.close();
			}
		%>

	</body>
</html>

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读 AI

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。