<!--#include file="upconn.asp"-->
<!--#include file="usercookies.asp"-->
<%Server.ScriptTimeOut=5000%>

<!--#include file = "foxx.inc"-->
<%
if instr(request.servervariables("http_referer"),"http://"&request.servervariables("host") )<1 then 
response.write "处理 URL 时服务器上出错。<br>非法攻击服务器，你的所有操作及ID已经被服务器记录。<br>我们会第一时间通知公安局网监来调查你的IP。 " 
response.end 
end if

dim upload,file,formElement,formFile,iCount,fileExt,id,username,formPath,rs,sql,filename
iCount=0
username=request.cookies("fox")("username")
set upload = new sjCat_Upload
Set file = upload.file("file1")
 id=upload.form("id")
 if file.filesize<1 then
 	response.write "<font size=2>请先选择你要上传的图片　[ <a href=# onclick=history.go(-1)>重新上传</a> ]</font>"
	response.end
 end if
 fileExt=lcase(right(file.filename,4))
 if fileEXT<>".gif" and fileEXT<>".jpg" and fileEXT<>".bmp" then
 	response.write "<font size=2>文件格式不对　[ <a href=# onclick=history.go(-1)>重新上传</a> ]</font>"
	response.end
 end if
 if file.filesize>1024000 then '这是1000K的图片大小数据
 	response.write "<font size=2>图片大小超过了限制(不大于100K)　[ <a href=# onclick=history.go(-1)>重新上传</a> ]</font>"
	response.end
 end if
 filename=formPath&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&fileExt
if file.FileSize>0 then
    file.Save2File Server.mappath("cardupfiles") & "\" & FileName  
	iCount=iCount+1
end if
set file=nothing
set upload=nothing

set rs=server.createobject("adodb.recordset")
sql = "select cardpic from FOX_user where username='"&username&"' and id="&cstr(id)
rs.open sql,conn,1,3
if rs.eof then
response.write "参数错误！"
response.end
else
rs("cardpic")=filename
rs.update
end if
rs.close
set rs=nothing
closedb
response.write "图片成功上传！"
response.write "<a target='_blank' href='cardupfiles/"&FileName&"'>查看</a>"
%></body></html>