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

📄 upload.asp

📁 1、采用4.5修改而成。 2、添加了求片区
💻 ASP
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../check.asp"-->
<!--#include file="upsave.inc"-->
<%'====================================================================
'=              Copyright (c) 2005,紫色(QQ8963017)开发             =
'=                      All rights reserved.                        =
'=------------------------------------------------------------------=
'=                     文件名称:upload.asp                   =
'=                     摘    要:后台—上传处理文件                 =
'=------------------------------------------------------------------=
'=                     用   途:免费电影系统                         =
'=                     最后更新:2005-03-24                         =
'====================================================================%>
<body leftmargin="0" topmargin="0" bgcolor=#F3F3FA>
<style type="text/css">*{font-size:12px;}</style>
<%
Server.ScriptTimeOut=999999
dim formName,formPath,filename,file_name,fileExt,Filesize,F_Type

call upload()

'===========================无组件上传============================
sub upload()
dim upload,file
set upload=new UpFile_Class ''建立上传对象
upload.GetDate (1000*1024)   '取得上传数据,不限大小

if upload.err > 0 then
    select case upload.err
	case 1
	Response.Write "<table><tr><td bgcolor=#F3F3FA>请先选择你要上传的文件 [ <a href=# onclick=history.go(-1)>重新上传</a> ]</td></tr></table>"
	case 2
	Response.Write "<table><tr><td bgcolor=#F3F3FA>文件大小超过了限制 [ <a href=# onclick=history.go(-1)>重新上传</a> ]</td></tr></table>"
	end select
	exit sub
	else
	formPath="../../images/uploadimg/"'upload.form("filepath")
	'在目录后加(/)
	'if right(formPath,1)<>"/" then formPath=formPath&"/"

for each formName in upload.file ''列出所有上传了的文件
	set file=upload.file(formName)  ''生成一个文件对象

	fileExt=lcase(file.FileExt)
	
	'判断文件类型
	if lcase(fileEXT)="asp" and lcase(fileEXT)="asa" and lcase(fileEXT)="aspx" then
		CheckFileExt(fileEXT)=false
	end if
	if CheckFileExt(fileEXT)=false then
 	response.write "<table><tr><td bgcolor=#F3F3FA>文件格式不正确 [ <a href=# onclick=history.go(-1)>重新上传</a> ]</td></tr></table>"
	response.end
	end if
	
	'付值变量
	randomize
	ranNum=int(90000*rnd)+10000
	file_name=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum
	filename=file_name&"."&fileExt
	rename=filename&"|"
	filename1=formPath&filename
	Filesize=file.FileSize

	'记录文件
	if Filesize>0 then         '如果 FileSize > 0 说明有文件数据
	file.SaveToFile Server.mappath(FileName1)   ''执行上传文件
'call ImgWriter(FileName1)'添加水印
	call checksave()			'记录文件
	end if
	set file=nothing
next
end if
set upload=nothing
	response.write "<table><tr><td bgcolor=#F3F3FA>"&FileName&"上传成功![ <a href=# onclick=history.go(-1)>重新上传</a> ]</td></tr></table>"
end sub

'判断文件类型是否合格
Private Function CheckFileExt (fileEXT)
dim Forumupload
Forumupload=split("jpg|gif|png","|")
	for i=0 to ubound(Forumupload)
		if lcase(fileEXT)=lcase(trim(Forumupload(i))) then
			CheckFileExt=true
			exit Function
		else
			CheckFileExt=false
		end if
	next
End Function

Private sub checksave()
	'插入上传表并获得ID
	response.write "<script>parent.form2.pic.value='images/uploadimg/"&FileName&"'</script>"
end Sub
Sub ImgWriter(SaveImgPath)    '添加水印
dim jpeg
Set Jpeg = Server.CreateObject("Persits.Jpeg")
Jpeg.Open Server.MapPath(SaveImgPath)
Jpeg.Canvas.Font.Color = &Hffffff
Jpeg.Canvas.Font.Family = "Tahoma"
Jpeg.Canvas.Font.Size = 16
Jpeg.Canvas.Font.ShadowColor = &H000000
Jpeg.Canvas.Font.ShadowXoffset = -1
Jpeg.Canvas.Font.ShadowYoffset = 1
Jpeg.Canvas.Font.Bold = true
Jpeg.Canvas.Print 10, 10, "Maxz.cn"
Jpeg.Canvas.Pen.Color = &Heeeeee
Jpeg.Canvas.Pen.Width = 1
Jpeg.Canvas.Brush.Solid = False
Jpeg.Canvas.Bar 0, 0, Jpeg.Width, Jpeg.Height
Jpeg.Save Server.MapPath(SaveImgPath)
End Sub
%>

⌨️ 快捷键说明

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