⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 per_addons_photoup.asp

📁 直接附加数据库! 修改 Include/ Class_Main.asp 为自己信息 后台admin admin 绍兴人才网程序
💻 ASP
字号:
<!--#include file="../Include/Class_Conn.asp" -->
<!--#include file="../Include/Class_photoup.inc" -->
<!--#include file="../Public/Person_Cookies.asp" -->
<html>
<head>
<title>文件上传</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<%

Dim Upload,File,FormName,FormPath,iCount,Filename,FileExt,Fs,SQL,Username,Photochk,Photo,Tupian,znum,Perid
Username = Session("Person")(0)
Perid    = Session("Person")(2)
Set Rs = Server.Createobject("adodb.recordset")
SQL = "Select Username,PhotoUrl From [pH_Person_Info] Where Username='"&username&"'"
Rs.Open SQL,Conn,1,3
if rs("photourl") <> "" then
response.write "<font size=2>您已经上传了照片</font>"
response.end
end if

set upload=new upload_5xSoft ''建立上传对象
formPath=upload.form("filepath")
''在目录后加(/)
if right(formPath,1)<>"/" then formPath=formPath&"/"

iCount=0
for each formName in upload.file ''列出所有上传了的文件
set file=upload.file(formName)  ''生成一个文件对象
if file.filesize<10 then
response.write "<script >alert('请先选择你要上传的图片!重新上传...');history.back(-1);</script>"
response.end
end if

if file.filesize>100000 then
response.write "<script >alert('图片大小超过了限制!重新上传...');history.back(-1);</script>"
response.end
end if

fileExt=lcase(right(file.filename,4))

if fileEXT<>".gif" and fileEXT<>".jpg" and fileEXT<>".jpeg" then
response.write "<script >alert('文件格式不对!重新上传...');history.back(-1);</script>"
response.end
end if

Randomize timer
zNum = cstr(cint(8999*Rnd+1000))

filename=formPath&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&znum&fileExt

if file.FileSize>0 then         ''如果 FileSize > 0 说明有文件数据
file.SaveAs Server.mappath(filename)   ''保存文件
'  response.write file.FilePath&file.FileName&" ("&file.FileSize&") => "&formPath&File.FileName&" 成功!<br>"
iCount=iCount+1
end if
tupian=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&znum&fileExt
set file=nothing
next
set upload=nothing  ''删除此对象

rs("photourl") = tupian
rs.update
rs.close
set rs=nothing

'//更改最后修改时间
SQL = "Update [pH_Person_Base] Set LastUpdate_Time='"&Now()&"' Where Perid='"&Perid&"'"
Conn.Execute(SQL)

CloseDB

response.write "<script>alert('图片上传成功!点击返回...');location.href='Per_Addons.asp';</script>"
%>

</body>
</html>

⌨️ 快捷键说明

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