<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> <%@ page import="java.sql.*"%> <%@ page import="java.io.*"%> <%@ page import="java.util.*"%> <%@ page import="java.util.regex.*"%> <%@ page import="com.ccgj.database.tool.*"%> <%@ page import="net.fiyu.edit.RemotePic"%> <%@ page import="net.fiyu.edit.UploadWebHelper,net.fiyu.edit.UploadBean"%> <%! // 参数变量 String sType, sStyleName; //' 设置变量 String sAllowExt, sUploadDir,sBaseUrl,sContentPath; int nAllowSize; //' 接口变量 String sFileExt,sSaveFileName,sOriginalFileName,sPathFileName,FileName, nFileNum; String sAction; Connection connect = null; %> <%! /*' ============================================ ' 去除Html格式,用于从数据库中取出值填入输入框时 ' 注意:value="?"这边一定要用双引号 ' ============================================*/ public String inHTML(String str) { String sTemp; sTemp = str; if(sTemp.equals("")) { System.exit(0); } sTemp = sTemp.replaceAll("&", "&"); sTemp = sTemp.replaceAll("<", "<"); sTemp = sTemp.replaceAll(">", ">"); sTemp = sTemp.replaceAll("\"", """); return sTemp; } //初始化上传限制数据 public void InitUpload(String realpath){ UploadWebHelper uw = new UploadWebHelper(); uw.filename = realpath+"WEB-INF/style.xml"; uw.getInstance(); UploadBean bean = uw.InitPara(); try{ sUploadDir = bean.getSuploaddir(); ////////////// ///add by zxl //if(!sUploadDir.endsWith(java.io.File.separator)) // sUploadDir = sUploadDir + java.io.File.separator; if(!sUploadDir.endsWith("/")) sUploadDir = sUploadDir + "/"; ///add by zxl end //System.out.println(sUploadDir); if(sType.equalsIgnoreCase("remote")) { sAllowExt = bean.getSremoteext(); sAllowExt = sAllowExt + "|" + sAllowExt.toUpperCase(); nAllowSize = Integer.parseInt(bean.getSremotesize()) ; //System.out.println(sAllowExt+nAllowSize); } else if(sType.equalsIgnoreCase("file")) { sAllowExt = bean.getSfileext(); sAllowExt = sAllowExt + "|" + sAllowExt.toUpperCase(); nAllowSize = Integer.parseInt(bean.getSfilesize()); //System.out.println(sAllowExt+nAllowSize); } else if(sType.equalsIgnoreCase("media")) { sAllowExt = bean.getSmediaext(); sAllowExt = sAllowExt + "|" + sAllowExt.toUpperCase(); nAllowSize = Integer.parseInt(bean.getSmediasize()); //System.out.println(sAllowExt+nAllowSize); } else if(sType.equalsIgnoreCase("flash")) { sAllowExt = bean.getSflashext(); sAllowExt = sAllowExt + "|" + sAllowExt.toUpperCase(); nAllowSize = Integer.parseInt(bean.getSflashsize()); //System.out.println(sAllowExt+nAllowSize); } else { sAllowExt = bean.getSimageext(); sAllowExt = sAllowExt + "|" + sAllowExt.toUpperCase(); nAllowSize = Integer.parseInt(bean.getSimagesize()); //System.out.println(sAllowExt+nAllowSize); } } catch(Exception e){ e.printStackTrace(); } } %> <% //设置类型 sType=request.getParameter("type"); if(sType==null) { sType="image"; } else sType=request.getParameter("type").trim(); //设置样式 sStyleName=request.getParameter("style"); System.out.println("sStyleName:"+sStyleName); if(sStyleName==null) { sStyleName="standard"; } else sStyleName=request.getParameter("style").trim(); //设置动作 sAction=request.getParameter("action"); System.out.println("sAction:"+sAction); if(sAction==null) { sAction="sun"; } else sAction=request.getParameter("action").trim(); %> <% //初始化上传变量 InitUpload(config.getServletContext().getRealPath("/")); //断开数据库连接 //sAction = UCase(Trim(Request.QueryString("action")) if(sAction.equalsIgnoreCase("remote")) { //远程自动获取 String sContent=""; String RemoteFileurl=null; String Protocol,sUrl; int Port; String LocalFileurl=null; String SrcFileurl=null; String SaveFileName=null; String sTemp[]=request.getParameterValues("eWebEditor_UploadText"); for(int i=0;i远程上传"); out.print(""); out.println(""); out.println(""); //DoRemote(); } else if(sAction.equalsIgnoreCase("save")) { //显示上传菜单 out.println(""); out.println(""); out.println("文件上传"); out.println(""); out.println(""); out.println(""); out.println(""); out.println(""); out.print("
"); out.println(""); out.println(""); out.println("
"); out.println(""); out.println(""); out.println(""); //存文件 //DoSave(); SmartUpload up = new SmartUpload(); //初始化上传组件 up.initialize(pageContext); //设置上传文件大小 //up.setMaxFileSize(nAllowSize*1024); //设置上传文件类型 String setExt=sAllowExt.replace('|',','); up.setAllowedFilesList(setExt); // Upload up.upload(); // Select each file for (int i=0;i"); out.print("parent.UploadSaved('"); out.print(sSaveFileName); out.print("');var obj=parent.dialogArguments.dialogArguments;if (!obj) obj=parent.dialogArguments;try{obj.addUploadFile('"); out.print(sOriginalFileName); out.print("', '"); out.print(sSaveFileName); out.print("', '"); out.print(sPathFileName); out.print("');} catch(e){}"); out.println(";history.back()"); } else { //显示上传表单 out.println(""); out.println(""); out.println("文件上传"); out.println(""); out.println(""); out.println(""); out.println(""); out.println(""); out.print("
"); out.println(""); out.println(""); out.println("
"); out.println(""); out.println(""); out.println(""); //out.println("123"); } %>