62 lines
2.4 KiB
Plaintext
62 lines
2.4 KiB
Plaintext
<%@ page contentType="text/html; charset=GBK"%><%@ include file="/IncludeBegin.jsp"%>
|
|
<%@page import="com.amarsoft.awe.common.attachment.AmarsoftUpload"%>
|
|
<%@page import="java.net.URLDecoder"%>
|
|
<%@page import="java.text.*,java.io.File"%><%
|
|
/*
|
|
Author: fmwu 2013/06
|
|
Content: 上传编辑的电子文档
|
|
*/
|
|
AmarsoftUpload myAmarsoftUpload = new AmarsoftUpload();
|
|
myAmarsoftUpload.initialize(pageContext);
|
|
myAmarsoftUpload.upload();
|
|
|
|
String sEDocNo = (String) myAmarsoftUpload.getRequest().getParameter("EDocNo");
|
|
String sDocType = (String) myAmarsoftUpload.getRequest().getParameter("DocType");
|
|
String sFilePath = (String) myAmarsoftUpload.getRequest().getParameter("FilePath");
|
|
String sFileName = (String) myAmarsoftUpload.getRequest().getParameter("FileName");
|
|
if(sDocType == null) sDocType = "Fmt";
|
|
//文件路径转码
|
|
sFilePath = URLDecoder.decode(URLDecoder.decode(sFilePath,"UTF-8"),"UTF-8");
|
|
//System.out.println("sFilePath=="+sFilePath);
|
|
//得到不带路径的文件名
|
|
ASResultSet rs = Sqlca.getASResultSetForUpdate("SELECT * FROM EDOC_DEFINE WHERE EDOCNO='" + sEDocNo + "'");
|
|
if (rs.next()) {
|
|
if (!myAmarsoftUpload.getFiles().getFile(0).isMissing()) {
|
|
try {
|
|
java.util.Date dateNow = new java.util.Date();
|
|
SimpleDateFormat sdfTemp = new SimpleDateFormat("yyyy/MM/dd");
|
|
String sUpdateTime = sdfTemp.format(dateNow);
|
|
|
|
myAmarsoftUpload.getFiles().getFile(0).saveAs(sFilePath);
|
|
|
|
rs.updateString("FullPath"+sDocType, sFilePath);
|
|
rs.updateString("ContentType"+sDocType, DataConvert.toString(myAmarsoftUpload.getFiles().getFile(0).getContentType()));
|
|
rs.updateString("ContentLength"+sDocType, DataConvert.toString(String.valueOf(myAmarsoftUpload.getFiles().getFile(0).getSize())));
|
|
rs.updateString("UPDATEUSER", CurUser.getUserID());
|
|
rs.updateString("UpdateOrg", CurUser.getOrgID());
|
|
rs.updateString("UPDATETIME", sUpdateTime);
|
|
rs.updateRow();
|
|
rs.getStatement().close();
|
|
|
|
myAmarsoftUpload = null;
|
|
} catch (Exception e) {
|
|
out.println("An error occurs : " + e.toString());
|
|
rs.getStatement().close();
|
|
myAmarsoftUpload = null;
|
|
%>
|
|
<script type="text/javascript">
|
|
alert(getMessageText('AWEW1010'));//上传文件失败!
|
|
self.returnValue = "EDocEditUpload_is_failure";
|
|
self.close();
|
|
</script>
|
|
<%
|
|
}
|
|
}
|
|
}
|
|
%>
|
|
<script type="text/javascript">
|
|
alert(getMessageText('AWEW1013'));//上传文件成功!
|
|
self.returnValue = "EDocEditUpload_is_success";
|
|
self.close();
|
|
</script>
|
|
<%@ include file="/IncludeEnd.jsp"%> |