<%@ page contentType="text/html; charset=gb2312" import="java.util.*,java.io.*,java.net.*,java.util.regex.*"%>
<%@ page import="com.evsoft.file.*" %>
<%@ page import="com.evsoft.db.*" %>
<%@ page import="com.evsoft.util.*" %>
<%@ page import="java.sql.*" %>
<html>
<head>
<title>数据导入</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="../../css/style.css" type=text/css rel=stylesheet>
<SCRIPT language=javascript src="../../js/checkbox.js" CHARSET="gb2312"></SCRIPT>
<script>
function submitinport()
{
if ( document.forms[0].filename1.value == "" )
{
alert("请输入数据来源文件!");
return false;
}
document.getElementById("pwait").style.display = ‘‘;
return false;
}
</script>
</head>
<body>
<table align=‘center‘ border=0 width=‘100%‘ height=‘100%‘ cellPadding=4 cellspacing=1 bgColor=#99ccff>
<tr>
<td valign=‘top‘ bgColor=#f0f4f9>
<%!
String Upload(HttpServletRequest request) throws Exception
{
String path = request.getRealPath("/excel_card");
System.out.println("import path = " + path);
String msg = "文件上传失败";
UploadFile fileBean = new UploadFile();
fileBean.setObjectPath(path);
fileBean.setSize(10000*1024);
fileBean.setSuffix(".txt.gif.jpg.png.jpge.html.htm.gz.xls.zip.csv");
fileBean.setNamingType(fileBean.OLD_NAME);
fileBean.setSourceFile(request);
String [] saSourceFile = fileBean.getSourceFile();
String [] saObjectFile = fileBean.getObjectFileName();
String [] saDescription = fileBean.getDescription();
String FileName = "";
int iCount = fileBean.getCount();
String fileName2 = saObjectFile[0];
String sObjectPath = fileBean.getObjectPath();
//Action = fileBean.getFieldValue("Action");
FileName = fileName2;
System.out.println("sam_____path_"+path +"/"+FileName);
return path +"/"+FileName;
}
%>
<%
String errHtml = "";
if ( request.getParameter("ss") == null )
{
String path = Upload(request);
System.out.println("path_sam==="+path);
String templateContent="";
FileInputStream fileinputstream = new FileInputStream(path);//读取模块文件
int lenght = fileinputstream.available();
byte bytes[] = new byte[lenght];
fileinputstream.read(bytes);
fileinputstream.close();
templateContent = new String(bytes);
//out.println("=================="+templateContent);
String fileame = "outport_sa.xls";
fileame = request.getRealPath("/")+"/new_report/"+fileame;//生成的outport文件保存路径
FileOutputStream fileoutputstream = new FileOutputStream(fileame);//建立文件输出流
byte tag_bytes[] = templateContent.getBytes();
fileoutputstream.write(tag_bytes);
fileoutputstream.close();
}
if ( errHtml.equals("") )
{
%>
<form name="form1" method="POST" enctype="MULTIPART/FORM-DATA" action="aa.jsp">
<br>
<input type=file size=30 class=input name=filename1><br>
<input type=submit name=inportIT value=" 确 定 " class=button3 onclick="submitinport()">
<br><br><br>
<div id="pwait" style="display:none">
正在导入,请稍候...
</div>
</form>
<%
}
%>
</td>
</tr>
</table>
</body>
</html>
联系客服