📄 insertimg1.jsp
字号:
<%@ page contentType="text/html; charset=gb2312" language="java" session="true"
import = "java.util.*,java.text.*,java.text.DecimalFormat,java.math.*,com.jspsmart.upload.*, com.jl.rp.*"
%>
<%
request.setCharacterEncoding("ISO8859-1");
boundWithSession bound = (boundWithSession)session.getAttribute("bound");
if(bound == null){
bound = new boundWithSession();
session.setAttribute("bound", bound);
}
StringBuffer strBuf = new StringBuffer();
String whichType = (String)session.getAttribute("whichType");
String flag = request.getParameter("flag");
out.println(flag);
if(whichType!=null && !"".equals(whichType)){
queryParent qp = new queryParent();
qp.doQuey(whichType);
ArrayList al = qp.arrayList;
for(int i=0;al!=null && i<al.size();i++){
strBuf.append("folder"+al.get(al.size()-i-1)+"\\");
}
java.io.File fileNew = new java.io.File(rpPathconf.newsUpPath+strBuf.toString());
if(!fileNew.exists())
fileNew.mkdirs();
}
Vector vec = (Vector)bound.getImageCollection();
Vector insertVec = (Vector)bound.getInsertCollection();
SmartUpload su = new SmartUpload();
su.initialize(pageContext);
String attachPath="";
try {
if(!"true".equals(flag))
su.upload();
if("upload".equals(su.getRequest().getParameter("action"))){
if(su.getFiles().getCount() > 0) {
for(int i=0;i<su.getFiles().getCount();i++){
com.jspsmart.upload.File file = su.getFiles().getFile(i);
Date date = new Date();
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
format.setLenient(false);
String strResponseDate = format.format(date);
attachPath = strResponseDate+"."+file.getFileExt();
file.saveAs(rpPathconf.newsUpPath+strBuf.toString()+attachPath);
vec.add(strBuf.toString()+attachPath);
insertVec.add(strBuf.toString()+attachPath);
}
}
}
} catch(Exception e) {
e.printStackTrace();
}
%>
<html>
<head>
<title>图片插入</title>
<style type="text/css">
<!--
body {
font-family: "Verdana", "宋体";
font-size: 9pt;
border: none;
}
input {
font-family: "Verdana", "宋体";
font-size: 9pt;
}
-->
</style>
<script Language="JavaScript">
function upload(){
var boFlag = true;
if(form1.file.value == ""){
boFlag = false;
alert("请首先选择项目进行上传!");
return;
}
if(boFlag){
form1.action.value="upload";
form1.submit();
}
}
function submitCurrent() {
window.parent.txtFileName.value =form1.elements("filePath").value ;<!-- form1.elements("filePath").value -->
if(form1.flag.value){
window.parent.btnOKClick();
}
}
</script>
</head>
<body leftmargin="0" topmargin="0">
<form name="form1" method="post" action="insertImg1.jsp" ENCTYPE="multipart/form-data">
<input name="filename" type="file" onChange="parent.onFileChange(this);">
<input type="hidden" name="filePath" value="<%="/newEdition/rp/getAttachTemp.jsp?path="+strBuf.toString()+attachPath%>" >
<input type="hidden" name="flag" value="<%=attachPath%>" >
<input type="hidden" name="action" value="<%=attachPath%>" >
</form>
</body>
</html>
<script language=Javascript>
submitCurrent();
</script>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -