<%@page import="java.net.URLDecoder"%> <%@page import="com.amarsoft.are.jbo.impl.BizObjectTableMapper"%> <%@page import="com.amarsoft.awe.util.DBKeyHelp"%> <%@page import="com.amarsoft.awe.common.attachment.*"%> <%@ page contentType="text/html; charset=GBK"%> <%@ include file="/IncludeBegin.jsp"%><% AmarsoftUpload myAmarsoftUpload = new AmarsoftUpload(); myAmarsoftUpload.initialize(pageContext); myAmarsoftUpload.upload(); String sDocNo = (String)myAmarsoftUpload.getRequest().getParameter("DocNo"); //文档编号 String sAttachmentNo = (String)myAmarsoftUpload.getRequest().getParameter("AttachmentNo"); //文档编号 List list = JBOFactory.createBizObjectQuery("jbo.sys.DOC_ATTACHMENT", "select * from O where DOCNO=:DOCNO and ATTACHMENTNO=:ATTACHMENTNO ") .setParameter("DOCNO", sDocNo).setParameter("ATTACHMENTNO", sAttachmentNo).getResultList(false); BizObject attchment=list.get(0); BizObjectManager bm = JBOFactory.getBizObjectManager("jbo.sys.DOC_ATTACHMENT"); String trueTable = ((BizObjectTableMapper)bm).getTable(); //取得真实的表名 //定义数据库操作变量 SqlObject so = null; String sNewSql = ""; String sFileSaveMode = CurConfig.getConfigure("FileSaveMode"); String sFileSavePath = CurConfig.getConfigure("FileSavePath"); String sFileNameType = CurConfig.getConfigure("FileNameType"); if (!myAmarsoftUpload.getFiles().getFile(0).isMissing()){ try { if(sFileSaveMode.equals("Disk")){ //存放文件服务器中 String sFilePath=sFileSavePath+attchment.getAttribute("fullpath").getString(); System.out.println(sFilePath); myAmarsoftUpload.getFiles().getFile(0).saveAs(sFilePath); } if(sFileSaveMode.equals("Table")){ //存放数据表中 myAmarsoftUpload.getFiles().getFile(0).fileToField(Sqlca,"update "+trueTable+" set DocContent=? where DocNo='"+sDocNo+"' and AttachmentNo='"+sAttachmentNo+"'"); } myAmarsoftUpload = null; }catch(Exception e){ myAmarsoftUpload = null; %> <% } } %> <%@ include file="/IncludeEnd.jsp"%>