<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<!--#include file="upload_wj.inc"-->
<%
  If Session("userid")="" Or Session("username")="" Then
     Response.Write("<Script language=javascrit>alert('您尚未登陆，或已经失效，请重新登陆');window.location.href='jcllk.asp';</script>")
	 Response.End()
  end If	 
%>
<!--#include file="inc/conn.asp"-->
<%
set upload=new upload_file
if upload.form("act")="uploadfile" then
	
	i=0
	for each formName in upload.File
		set file=upload.File(formName)
 
 fileExt=lcase(file.FileExt)	
 if file.filesize<100 then
 	response.write "<span style=""font-family: 宋体; font-size: 9pt"">请先选择你要上传的文件！　[ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
	response.end
 end if
	if fileext<>"gif" and fileext<>"jpg" and fileext<>"png"  then
		response.write "<span style=""font-family: 宋体; font-size: 9pt"">只能上传jpg或gif格式的图片！　[ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
		response.end
 	end if
 if filelx="jpg" then
	if file.filesize>(150*1024) then
		response.write "<span style=""font-family: 宋体; font-size: 9pt"">最大只能上传 150K 的图片文件！　[ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
		response.end
	end if
 end if

 randomize
 ranNum=int(90000*rnd)+10000
 filename="upload/"&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum&"."&fileExt
%>
<%
 if file.FileSize>0 then
  file.SaveToFile Server.mappath(FileName)
  Conn.Execute("Insert into pic([user],pic,sortid,[check],[number],Content) values('"&Session("userid")&"','"&filename&"',2,0,0,'"&left(Server.HTMLEncode(upload.form("Content")),150)&"')")
%>
<%
 end if
 set file=nothing
	next
	set upload=nothing
end if
%>
<script language="javascript">
window.alert("文件上传成功!");
window.close();
</script>
