<!--#include file="General.inc.asp"-->
<!--#include file="uploadfile.inc"-->
<%
dim upload,file,formName,formPath,iCount
set upload = new Jeansecool_uploadClass
formPath = "/images/Other/"
set fso=server.createobject("scripting.filesystemobject")
if fso.FolderExists(server.mappath(formPath))=false then
	fso.CreateFolder server.mappath(formPath)
end if
set fso=nothing
fileName = ""
for each formName in upload.file ''列出所有上传了的文件
	set file=upload.file(formName)  ''生成一个文件对象
	if file.FileSize>0 then         ''如果 FileSize > 0 说明有文件数据
		fileName = file.FileName
		fileType = lcase(right(fileName,4))
		if left(fileType,1)="." then fileType = right(fileType,3)
		if fileType<>"jpg" and fileType<>"gif" and fileType<>"bmp" and fileType<>"png" and fileType<>"jpeg" then
			ErrorInfo "文件必须是图片格式！"
			fileName = ""
		else
			fileName = formPath & year(now()) & "_" & month(now()) & "_" & day(now()) & "_" & hour(now()) &  "_" & minute(now()) &  "_" & second(now()) & "." & fileType
			file.SaveAs Server.mappath(fileName)   ''保存文件
		end if
		iCount=iCount+1
	end if
	set file=nothing
next
set upload=nothing  ''删除此对象
if fileName <> "" then
	Response.Write "<script language=""javascript"">window.opener.img.value=""" & fileName & """;window.close();</script>"
else
	CommitInfo "请选择图片！"
end if
%>