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

📄 upfile_image.asp

📁 秘密网源代码 传闻拉了 100W风投
💻 ASP
字号:
<!--#include file="../WoLib/Function.asp"-->
<!--#include file="upload_wj.inc"-->
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<%
if Request.Cookies("UserID") = "" then
	Response.End()
end if

set upload=new upload_file 'upload就是一个对象
if upload.form("act")="uploadfile" then

	filepath	= Session("uppath") '属性,上传前文件所在的路径
	filelx		= trim(upload.form("filelx"))
	EditName    = trim(upload.form("EditName"))

	

   WoDig.CreateMultiFolder(filepath)
		
	i = 0
	for each formName in upload.File
		 set file=upload.File(formName)
		 fileExt=lcase(file.FileExt)	'得到的文件扩展名不含有.
		 fileExt=lcase(fileExt)
		
		 if fileExt <> "gif" and fileExt <> "jpg" and  fileExt <>"png" and fileExt <> "bmp" then	'限死了文件类型
		 	Response.Write("<span style=""font-family: 宋体; font-size: 9pt"">您只能上传 [gif/jpg/png/bmp] 类型的文件! [ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>")
		 	Response.End()
		 end if
		 
		 if file.filesize<100 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>(100*1024) then
				response.write "<span style=""font-family: 宋体; font-size: 9pt"">最大只能上传 100K 的图片文件! [ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
				response.end
			end if
			
		 if (filelx="asp") or filelx="aspx"  then 
			response.write "<span style=""font-family: 宋体; font-size: 9pt"">该文件类型不能上传! [ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
			response.end
		 end if
		 if filelx="swf" then
			if fileext<>"swf"  then
				response.write "<span style=""font-family: 宋体; font-size: 9pt"">只能上传swf格式的Flash文件! [ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
				response.end
			end if
		 end if
		 if filelx="jpg" then
			if fileext<>"gif" and 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
		 end if
		 if filelx="swf" then
			if file.filesize>(3000*1024) then
				response.write "<span style=""font-family: 宋体; font-size: 9pt"">最大只能上传 3M 的Flash文件! [ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
				response.end
			end if
		 end if
		 if filelx="jpg" then
			if file.filesize>(1000*1024) then
				response.write "<span style=""font-family: 宋体; font-size: 9pt"">最大只能上传 1000K 的图片文件! [ <a href=# onclick=history.go(-1)>重新上传</a> ]</span>"
				response.end
			end if		
		 end if
				
		 randomize
		 ranNum=int(90000*rnd)+10000
		
	if EditName="src_img" then
	filename=filepath&"s"&filepre&right(year(now),2)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum
	elseif EditName="user_photo" then
	filename=filepath&"userphoto"
	else	filename=filepath&filepre&right(year(now),2)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum
	end if

	filename=filename&"."&fileExt

		
		 if file.FileSize>0 then         ''如果 FileSize > 0 说明有文件数据
			  file.SaveToFile Server.mappath(FileName)			 
			  if filelx="swf" then
				  response.write "<script>window.opener.document."&upload.form("FormName")&".size.value='"&int(file.FileSize/1024)&" K'</script>"
			  end if  
			  response.write "<script>window.opener.document."&upload.form("FormName")&"."&upload.form("EditName")&".value='"&FileName&"'</script>"
			  if upload.form("ImgSrc") <> "" and not isNull(upload.form("ImgSrc")) then
			
				  response.write "<script>window.opener.document."&upload.form("FormName")&"."&upload.form("ImgSrc")&".src='"&FileName&" '</script>"
			  end if
		 end if
		 set file=nothing
	next
	set upload=nothing
end if
%>
<script language="javascript">
//window.alert("文件上传成功!请不要修改生成的链接地址!");
window.close();
</script>

⌨️ 快捷键说明

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