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

📄 savepic.asp

📁 党委网站 党委网站党委网站党委网站党委网站党委网站
💻 ASP
字号:
<!--#include file="upclass.asp"-->
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="images/main.css" rel="stylesheet" type="text/css">
<body bgcolor="#D4D0C8">
<%
set upload=new clsUp		'建立上传对象
upload.NoAllowExt="asp;asa;cer;aspx;cs;vb;js;"		'设置上传类型的黑名单 
filepath="../photo/"		'上传路径
filepathname = "photo/"
filext="gif;jpg;png;"
upload.AllowExt=filext		'设置上传类型的黑名单 
upload.GetData (3072000)	'取得上传数据,限制最大上传3M

if upload.form("act")="uploadfile" then
	for each formName in upload.File
		set file=upload.File(formName)
		fileExt=lcase(file.FileExt)		'得到的文件扩展名不含有.
			if file.filesize<10 then
				response.write "<span style=""font-family: 宋体; font-size: 9pt"">请先选择你要上传的文件! [ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
				response.end
			end if
			if file.filesize>(3000*1024) then
				response.write "<span style=""font-family: 宋体; font-size: 9pt"">最大只能上传 3000K 的图片文件! [ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
				response.end
			end if
			
			if trim(file.fileext)<>"gif" and trim(file.fileext)<>"jpg"  then
				response.write "<span style=""font-family: 宋体; font-size: 9pt"">只能上传jpg或gif格式的图片,系统将记录你的非法操作! [ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
				response.end
     		end if

		dtNow=Now()
		randomize
		ranNum=int(90000*rnd)+10000
		filename1=year(dtNow) & right("0" & month(dtNow),2) & right("0" & day(dtNow),2) & right("0" & hour(dtNow),2) & right("0" & minute(dtNow),2) & right("0" & second(dtNow),2) & ranNum &"."&fileExt
		filename=filepath&filename1
		filelstname=filepathname&filename1
		
		if file.FileSize>0 then         ''如果 FileSize > 0 说明有文件数据
			upload.SaveToFile formName,Server.mappath(FileName)

			'这里可以存数据库



  response.write "<script>parent."&upload.form("EditName")&".value='"&FileName&"'</script>"
	

		end if
		set file=nothing
	next
	set upload=nothing
	
end if
response.Write("<script language=javascript>")
response.Write("window.location.href='uppic.asp';")
response.Write("</script>")
%>
</body>

⌨️ 快捷键说明

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