📄 user_uploadface.asp
字号:
<!--#include file=INC/skin.asp-->
<%
dim const_txl_HomeUrl,errstr,login_username
login_username=Session("username")
If login_username="" Then
Call SiteHead2 (const_txlname&"-上传头像")
Response.write "<center><font style='font-size:12px;color:red' ><br><br>还没有登录或连接会话超时,请先登录!<br><a href=javascript:window.close()>[关闭窗口]</a></font></center>"
Call web_end2
Response.End
End If
errstr=""
const_txl_HomeUrl=""
OpenDatabase
SiteHead2 const_txlname&"-"&login_username&"-上传头像"
call online
Select Case Request.QueryString("action")
Case "upload":
Call uploadface
Case Else:
Call main
End Select
CloseDatabase
Call web_end
Sub main
%>
<div align="center">
<form action="?action=upload" method="post" enctype="multipart/form-data" name="form1">
【限<font color="red"><%=const_MaxUploadFaceSize%></font>K,.jpg,.gif,.bmp】<br>
<input type="file" name="file">
<input type="submit" name="Submit" value="上传">
<br>
</form>
【<a href="javascript:window.close()">关闭窗口</a>】</div>
<%
End Sub
Sub uploadface
if outsitesubmit Then
Call printerror ("上传头像出错","<li>请不要外部提交数据!</li>",400)
exit sub
End If
if const_EnableUploadface<>1 then
errstr=errstr&"<li>Wap影音当前设置<font color='red'>不能上传头像</font>!</li>"
errstr=errstr&"<li>如果还有疑问请与管理员联系!</li>"
Call printerror("上传头像出错!",errstr,400)
Exit Sub
End If
%>
<!--#include file=INC/upload_5xsoft.inc-->
<%
'on error resume next
Dim upload,file,formName,FileExp,iCount,TotalSize,filename
set upload=new upload_5xsoft
If not isobject(upload) Then
Call printerror ("上传头像出错","<li>服务器不支持该上传对象!</li>",400)
upflag=False
exit sub
End If
iCount=0
For each formName in upload.objFile
Set file=upload.file(formName)
If file.FileSize>0 Then
FileExp=Right(file.FileName,Len(file.FileName)-InstrRev(file.FileName,".")+1)
FileExp=lcase(FileExp)
if FileExp<>".jpg" and FileExp<>".gif" and FileExp<>".bmp" then
Call printerror ("上传头像出错","<li>不能上传该格式的文件!</li>",400)
exit sub
End IF
TotalSize=file.FileSize/1024
If TotalSize>const_MaxUploadFaceSize Then
Call printerror ("上传头像出错","<li>所传文件已经大于Wap影音设定的允许值<font color=red>"&const_MaxUploadFaceSize&"K</font>,当前所传文件大小"&FormatNumber(TotalSize,1)&"Kb!</li>",400)
exit sub
End If
randomize
filename="face_"&hour(now)&minute(now)&Cstr(Int(1000*rnd))&FileExp
File.SaveAs Server.mappath(const_txl_HomeUrl&const_faceuploadurl2&filename) ''保存文件
iCount=iCount+1
Else
Call printerror ("上传头像出错","<li>上传数据为空,请检查该文件是否存在!</li>",400)
exit sub
End If
Set File=nothing
next
set upload=nothing ''删除此对象
Response.write "<script>"&Vbcrlf
Response.write "opener.document.txlfrm.faceimg.src='"&const_faceuploadurl2&filename&"';"&Vbcrlf
Response.write "opener.document.txlfrm.txl_FaceUrl.value='"&const_faceuploadurl2&filename&"';"&Vbcrlf
Response.write "alert('上传成功!');"&Vbcrlf
Response.write "window.close();"&Vbcrlf
Response.write "</script>"&Vbcrlf
End Sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -