<!--#include file="inc/upload.inc"-->
<!--#INCLUDE FILE="conn.asp" -->
<!--#INCLUDE FILE="Class_Checkuser.asp" -->
<%if membername="" then
response.write"您还没有登陆！"
elseif not BoolVar(10) then
response.write"系统禁止上传头像！"
else
dim rs,sql
set rs=server.createobject("adodb.recordset")
sql="select * from [student] where userid='"&membername&"'"
rs.open sql,conn,1,3%>
<script>parent.document.forms[0].Submit.disabled=false;
parent.document.forms[0].Submit2.disabled=false;</script>
<STYLE type=text/css>
BODY {
	BACKGROUND-POSITION: center 50%; SCROLLBAR-FACE-COLOR: #dee3e7; FONT-SIZE: 12px;  SCROLLBAR-HIGHLIGHT-COLOR: #ffffff; SCROLLBAR-SHADOW-COLOR: #dee3e7; COLOR: #333333; SCROLLBAR-3DLIGHT-COLOR: #d1d7dc; SCROLLBAR-ARROW-COLOR: #006699; SCROLLBAR-TRACK-COLOR: #efefef; FONT-FAMILY: 宋体; BACKGROUND-COLOR: #ecf2fc
}
INPUT {
	BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; FONT-SIZE: 12px; BORDER-LEFT: #000000 1px solid; LINE-HEIGHT: 15px; BORDER-BOTTOM: #000000 1px solid; FONT-FAMILY: Verdana,Tahoma,宋体
}
</style>
<% 
dim filename,savefilename,savesuccess
filename = "userface"&rs("studid")
rs.close
set rs=nothing
call uploadfile()
if savesuccess=1 then 
response.write "<script>parent.document.forms[0].userface.value='UploadFiles/UserFaces/"&savefilename& "'</script>"
end if
end if
call EndConnection()
sub uploadfile()
dim upload,file,formName,formPath,iCount 
dim getname,endname,chkname
dim filepaths,objFSO,upface

set upload=new upload_kisssnow   ''建立上传对象 
formPath="UploadFiles/UserFaces"          '上传路径
if right(formPath,1)<>"/" then formPath=formPath&"/"    '在目录后加(/) 
iCount=0 
for each formName in upload.file '列出所有上传了的文件 
set file=upload.file(formName)   '生成一个文件对象 
if file.FileSize<=1024 or file.FileSize>30*1024 then            '  如果 FileSize > 0 说明有文件数据 ,文件最大不能超过1000kb
response.write "<body topmargin=0 leftmargin=0><div align=left style=font-size:9pt><font color=red>文件过大！只可以上传1K-30K的文件！<a href=Class_Uploadface.asp?upload=yes target=_self>重新上传</a></font></div></body>"
exit sub 
end if

getname=left(file.FileName,inStr(file.FileName,".")-1)
endname=Replace(File.fileName,getname,"")
  Select case endname
  case ".gif"
  chkname=0
  'case ".jpg"
  'chkname=0
  'case ".jpeg"
  'chkname=0
   case ".GIF"
  chkname=0
  ' case ".JPG"
  'chkname=0
  ' case ".JPEG"
 ' chkname=0
  case else
  chkname=1
 End select
 if chkname=1 then 
 response.write "<body topmargin=0 leftmargin=0><div align=left style=font-size:9pt><font color=red>文件类型错误！只允许Gif格式的图片！<a href=Class_Uploadface.asp?upload=yes target=_self>重新上传</a></font></div></body>"
exit sub 
end if
savefilename=filename&endname
file.SaveAs Server.mappath(formPath&savefilename)            '########保存文件 
set file=nothing 
next
set upload=nothing ''删除此对象
If IsObjInstalled("Persits.Jpeg") then
dim jpeg,fso
Set Jpeg = Server.CreateObject("Persits.Jpeg")
Jpeg.Open Server.MapPath(formPath&savefilename)
if jpeg.width>120 or jpeg.height>120 then
if IsObjInstalled("Scripting.FileSystemObject") then
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
if fso.FileExists(Server.MapPath(formPath&savefilename)) then
FSO.DeleteFile(Server.MapPath(formPath&savefilename))
end if
Set fso=nothing
end if
response.write "<body topmargin=0 leftmargin=0><div align=left style=font-size:9pt><font color=red>文件宽和高都不可以超过120象素！<a href=Class_Uploadface.asp?upload=yes target=_self>重新上传</a></font></div></body>"
exit sub
else
savesuccess=1
end if
Set Jpeg = Nothing
else
savesuccess=1
end if
response.write"<body topmargin=0 leftmargin=0><div align=left style=font-size:9pt><font color=red>请点击底部的""更新资料""按钮完成修改！<a href=Class_Uploadface.asp?upload=yes target=_self>重新上传</a></font></div></body>"
end sub
'''''''''''检测组建涵数''''''''''
Function IsObjInstalled(strClassString)
On Error Resume Next
IsObjInstalled = False
Err = 0
Dim xTestObj
Set xTestObj = Server.CreateObject(strClassString)
If 0 = Err Then IsObjInstalled = True
Set xTestObj = Nothing
Err = 0
End Function
'''''''''''''''''结束'''''''''''
%>