<!--#include file="conn.asp" -->
<!--#include file="adminpic/const.asp" -->
<!--METADATA TYPE="typelib"      UUID="00000205-0000-0010-8000-00AA006D2EA4"     NAME="ADODB Type Library"-->
<body style="font-size: 9pt" bgcolor="#F7F7F7">
<%
FilePath="p"
FileMaxSize="MaxFileSize*1024"
FileType="gif|jpg"
fileweb=http://yile8.com/pic/
function makefilename(fname)
  fname = now()
  fname = replace(fname,"-","")
  fname = replace(fname," ","") 
  fname = replace(fname,":","")
  fname = replace(fname,"PM","")
  fname = replace(fname,"AM","")
  fname = replace(fname,"上午","")
  fname = replace(fname,"下午","")
  makefilename=fname
end function 
%>
<!--#include FILE="upload_5xsoft.inc"-->
<%
dim upload,file,formName,iCount
set upload=new upload_5xSoft ''建立上传对象
UpFilePath = upload.form("filepath")
if right(UpFilePath,1)<>"/" then UpFilePath=UpFilePath&"/" 
iCount=0
for each formName in upload.file
set file=upload.file(formName)
if file.FileSize>0 then         ''如果 FileSize > 0 说明有文件数据
	if file.FileSize<FileMaxSize then ''如果未超过文件大小限制

		if FileType<>"" then	'如果限制了上传文件类型
			if Instr(FileType,GetExtendName(file.FileName)) then
				TypeFlag = 1        '文件为允许的类型
			else
				TypeFlag = 0		'文件为不允许的类型
 				Response.write "不支持您所上传的文件类型："
				Response.write GetExtendName(file.FileName)
				Response.write "<br>"
			end if
		end if
           if file.filesize>1024 then 
                      filesize=file.filesize/1024
                      end if
		if TypeFlag = 1 then 
			vfname = makefilename(now())
			fname = vfname & iCount & "." & GetExtendName(file.FileName)
			file.SaveAs Server.mappath(UpFilePath&fname)
			response.write file.FilePath&file.FileName&" ("&file.FileSize&") => 上传文件成功! <br>"
			response.write "<script>parent.document.postart.picadd.value='"&fname&"'</script>"
                        response.write "<script>parent.document.postart.tuda.value='"&int(FileSize)&"'</script>"
			iCount=iCount+1
			FileNameStr = UpFilePath&fname
		end if
	else
		response.write "文件大小超出限制，您最多可以上传 "& FileMaxSize &"个字节的文件数据"
		exit for
	end if
end if
set file=nothing
next
set upload=nothing


function GetExtendName(FileName)
dim ExtName
ExtName = LCase(FileName)
ExtName = right(ExtName,3)
ExtName = right(ExtName,3-Instr(ExtName,"."))
GetExtendName = ExtName
end function
conn.close
set conn=nothing
%>
</body>