upphoto.asp

来自「又一套oa 系统,供大家使用学习,更多的源代码正在上传中,好的程序应该大家共同使」· ASP 代码 · 共 30 行

ASP
30
字号
<!--#INCLUDE FILE="../HXINCLUDE/HXINCLUDEHEAD.ASP"-->
<!--#INCLUDE FILE="../HXINCLUDE/HX_photo.asp"-->
<%set upload=new upload_file:WS_Uid=upload.form("WS_Uid"):call WS_S.ChkIsOuter():filepath="../hximages/upfile/"
if (WS_Uid<>"" and not isnumeric(WS_Uid)) or WS_Uid="" then response.write "<script>alert('非法操作!');window.close();</script>":response.end
for each formName in upload.File
	set file=upload.File(formName)
    fileExt=lcase(file.FileExt)	'得到的文件扩展名不含有.
    if file.filesize<100 then HX_GoBack "请先选择你要上传的文件!","" 
	if fileext<>"gif" and fileext<>"jpg" and fileext<>"tif" and fileext<>"bmp" and fileext<>"png" then fileExt="gif":HX_GoBack "只能上传JPG,JPEG,GIF,TIF,BMP,PNG格式的图片!",""
	if file.filesize>(1000*1024) then HX_GoBack "图片文件大小不能超过1m!"
    randomize:ranNum=int(90000*rnd)+10000:filename=filepath&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum&"."&fileExt 
    if file.FileSize>0 then file.SaveToFile Server.mappath(FileName)
    set file=nothing
next
ColumnName="":Tablename="HX_CompanyUser":Orderby=" where WS_Uid="&WS_Uid
set rs=WS_S.HX_SetRSD(ColumnName,Tablename,Orderby)
if rs.recordcount>0 then WS_Photo=rs("WS_Photo")
if isnull(WS_Photo)=False and WS_Photo<>"" then
 if WS_S.ChkObjInstalled("scripting.FileSystemObject") then
  Filenamepath = Server.MapPath(WS_Photo) 
  Set fs = CreateObject("scripting.FileSystemObject") 
  If fs.FileExists(Filenamepath) Then fs.DeleteFile(Filenamepath)
  set fs=nothing
 end if
end if
rs("WS_Photo")=filename
rs.update
set upload=nothing
response.write "<script>alert('上传成功!');window.opener.location.reload();window.close();</script>"
response.end%>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?