📄 upload.jsp
字号:
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ include file="/app/inc/taglibs2.jsp"%>
<html:html>
<head>
<title>上传附件</title>
<script language="JavaScript">
var vbDOMtype = '';
if (document.getElementById) {
vbDOMtype = "std";
}
else if (document.all) {
vbDOMtype = "ie4";
}
else if (document.layers){
vbDOMtype = "ns4";
}
var openner=window.opener==null?parent:window.opener;
switch (vbDOMtype) {
case "std":{
var attachlist = openner.document.getElementById("attachList");
}
break;
case "ie4": {
var attachlist = openner.document.all["attachList"];
}
}
function verify_upload(formobj) {
var haveupload = false;
for (var i=0; i < formobj.elements.length; i++) {
var elm = formobj.elements[i];
if (elm.type == 'file'){
if (elm.value != ""){
haveupload = true;
}
}
}
if (haveupload){
toggle_display();
formobj.submit();
formobj.upload.disabled=true;
} else {
alert("Please select your file for upload.");
}
return false;
}
function toggle_display() {
var obj=uploading;
if (obj.style.display == "none") {
obj.style.display = "";
} else {
obj.style.display = "none";
}
}
</script>
<%
int curNum = Integer.parseInt(request.getAttribute("curNum").toString());
%>
</head>
<body>
<html:form action="/manage/UpLoad.html" enctype="multipart/form-data" method="post" >
<input type="hidden" name="artId" value="<bean:write name="artId" />">
<input type="hidden" name="action" value="<bean:write name="action" />">
<table class="tab1" cellpadding=3 cellspacing=1 border=0 align=center>
<tr class="tr_1">
<td align=center colspan=2 ><b>管理附件</b></td>
</tr>
<tr>
<td width=40% class="td_t"><center><font color="red"><html:errors /></font></center>
<b>上传附件或图片</b><br>最大允许 <B>2048KB</B>
</td>
<td class="td_lt">
<%
for(int i=0;i<curNum;i++) {
%>
<input type="file" size=30 name="formFile<%=i%>"><br>
<%
}
%>
<select>
<option value=#>选择上传类型:</option>
<option value=#>----------</option>
<option value=gif>gif</option>
<option value=jpg>jpg</option>
<option value=png>png</option>
<option value=bmp>bmp</option>
<option value=bmp>swf</option>
<option value=rar>rar</option>
<option value=zip>zip</option>
<option value=doc>doc</option>
<option value=txt>txt</option>
</select>
</td>
</tr>
<tr>
<td align=center colspan=2 class="td_t">
<input type="button" name="upload" value="上传" onclick="verify_upload(this.form);" />
</td>
</tr>
<logic:lessThan name="curNum" value="6">
<tr>
<td class="td_t">
<b>当前上传附件:</b>
</td>
<td class="td_lt">
<div id="uploadlist">
</div>
<script language="JavaScript">
var attachListStr="";
var insertText="";
<logic:iterate id="attment" indexId="ind" name="allattmts">
insertText+= "<a href='../DownFile.html?fileName=<bean:write name='attment' property='filename' />'><bean:write name='attment' property='realname' /></a><a href='UpLoad.html?faction=delete&fId=<bean:write name='attment' property='id' />&filePath=<bean:write name='attment' property='path' />'> 删除</a><br> ";
attachListStr+= "<a href='../DownFile.html?fileName=<bean:write name='attment' property='filename' />'> "+
"<bean:write name='attment' property='realname' /></a> <a href=javascript:insertAtt('<bean:write name='attment' property='path' />','<bean:write name='attment' property='realname' />','<bean:write name='attment' property='filetype' />')> 插入</a><br>";
</logic:iterate>
uploadlist.innerHTML = ""+insertText;
opener.attachList.innerHTML = ""+attachListStr;
</script>
</td>
</tr>
</logic:lessThan>
<logic:lessThan name="curNum" value="0">
<script>opener.attachList.innerHTML='';</script>
</logic:lessThan>
<tr id="uploading" style="display:none;">
<td align=center colspan=2>
<strong>Uploading, please wait...</strong>
</td>
</tr>
<tr>
<td align=center colspan=2 class="td_t">
<input type="button" value="关闭" onclick="window.close();" />
</td>
</tr>
</table>
</html:form>
</body>
</html:html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -