?? upload.jsp.svn-base
字號:
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<%@ page import="com.alipay.util.*"%>
<%@ page import="org.apache.commons.codec.digest.DigestUtils"%>
<%@ page import="org.apache.commons.io.IOUtils"%>
<%@ page import="java.util.*"%>
<%@ page import="java.io.*"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>支付寶支付</title>
</head>
<body>
<%
String filePath = request.getParameter("bptb_pay_file");
//有文件設置
if (filePath != null) {
FileInputStream fileInputStream = null;
try {
fileInputStream = new FileInputStream(new File(filePath));
int size = fileInputStream.available();
byte[] content = new byte[size];
//md5方式*********************************************************************
DigestUtils.md5(content);
//需要使用IOUtils.toByteArray是否提醒商戶知道?
String code = DigestUtils.md5Hex(IOUtils
.toByteArray(fileInputStream));
session.setAttribute("code", code);
session.setAttribute("bptb_pay_file", filePath);
response.sendRedirect("pay.jsp");
System.out.println(code);
return;
// byte[] content = IOUtils.toByteArray(fileInputStream);
// String code = DigestUtils.shaHex(content);
// DigestUtils.sha(content);
// System.out.println(code);
// session.setAttribute("code", code);
// session.setAttribute("bptb_pay_file", filePath);
// response.sendRedirect("pay.jsp");
// return;
} catch (Exception e) {
e.printStackTrace();
} finally {
fileInputStream.close();
}
}
%>
<form name="upload" action="upload.jsp" method="post">
<tr bgcolor="#FFFFFF">
<td valign="middle" width="50%" height="20" class="link_font">Upload
Refund File:</td>
</tr>
<tr>
<td height="5"> </td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="left" width="100%" valign="top"><input type="file"
name="bptb_pay_file"><br>
<input type="submit" value="Upload File"></td>
</tr>
</form>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -