<!--#include file="../include/conn.jsp"-->
<!--#include file="../include/const.jsp"-->
<!--#include file="../include/upload.inc"-->
<!--#include file="../include/char.inc"-->
<style type=text/css>
input{
    border-right: #cccccc 1px groove; font-weight: normal; font-size: 9pt; line-height: normal; border-bottom: #cccccc 1px groove; font-style: normal; background-color: #eeeeee; font-variant: normal
	}
select {
	font-size: 12px; filter: alpha(opacity=50); color: #666666; font-family: "song", "ms shell dlg", "宋体"; background-color: #f5f5f5
}
</style>
<link href="../include/Style.css" rel="stylesheet" type="text/css">
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="4">
<script>
parent.document.LatticeEditorForm.Submit.disabled=false;
parent.document.LatticeEditorForm.Submit2.disabled=false;
</script>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td valign=top height=40>
<%
dim file_ext,uploadsize

file_ext=site_info(13)
uploadsize=cint(site_info(12))

dim upload,file,formName,formPath,iCount,filename,fileExt
dim upNum
dim uploadsuc
dim Forumupload
dim ranNum
dim uploadfiletype
dim ss
upNum=request.cookies("aspxnet")("upNum")
if not isnumeric(upnum) then upnum=1

response.write "<FONT color=red>"&upNum&"</font>"

call upload_0()

sub upload_0()
set upload=new upfile_class ''建立上传对象
upload.GetDate (-1)

formPath=upload.form("filepath")

'在目录后加(/)
if right(formPath,1)<>"/" then formPath=formPath&"/" 

iCount=0
for each formName in upload.file ''列出所有上传了的文件
	set file=upload.file(formName)  ''生成一个文件对象
	if file.filesize<100 then
 	response.write "请先选择你要上传的文件　[ <a href=# onclick=history.go(-1)>重新上传</a> ]"
	response.end
	end if
 	
	if file.filesize>cint(uploadsize)*1000 then
 	response.write "<font size=2>文件大小超过了限制 "&uploadsize&"K　[ <a href=# onclick=history.go(-1)>重新上传</a> ]</font>"
	response.end
	end if

	fileExt=lcase(right(file.filename,4))
	uploadsuc=false
	Forumupload=split(file_ext,",")
	for i=0 to ubound(Forumupload)
		if fileEXT="."&trim(Forumupload(i)) then
			uploadsuc=true
			exit for
		else
			uploadsuc=false
		end if
	next
	if fileEXT=".jsp" and fileEXT=".asa" and fileEXT=".jspx" then
		uploadsuc=false
	end if
	if uploadsuc=false then
 	response.write "文件格式不正确　[ <a href=# onclick=history.go(-1)>重新上传</a> ]"
	response.end
	end if

	randomize
	ranNum=int(90000*rnd)+10000
	filename=formPath&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum&fileExt

	if file.FileSize>0 then         ''如果 FileSize > 0 说明有文件数据
	file.SaveToFile Server.mappath(FileName)   ''保存文件
	for i=0 to ubound(Forumupload)
		if fileEXT="."&trim(Forumupload(i)) then
	     response.write "<script>parent.LatticeEditorForm.txtContent.value+='[upload="&Forumupload(i)&"]../../"&filename&"[/upload]';"&_
	                             "parent.frames.LatticeEditDocument.document.body.innerHTML+='<img src="&filename&"></img>';"
         response.write "</script>"
		exit for
		end if
	next
	iCount=iCount+1
	end if
	set file=nothing
next
set upload=nothing

Htmend iCount&" 个文件上传结束!"
end sub

sub HtmEnd(Msg)
	if upNum="" then upNum=1
	response.cookies("aspxnet")("upNum")=upNum+1
	response.write "文件上传成功 [ <a href=# onclick=history.go(-1)>继续上传</a> ]"
	response.end
end sub
%>
</td></tr>
</table>
</body>
</html>

