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

📄 upfile_testpic5.asp

📁 提供企业bug的追踪流程
💻 ASP
字号:
<!--#include file="../config.asp"-->
<!--#include file="../common/upload.asp"-->

<%
if request.QueryString("No")<>"" then


dim upload,file,formName,SavePath,filename,fileExt,fileexistpath,filetruename
dim upNum
dim EnableUpload
dim Forumupload
dim ranNum
dim uploadfiletype
dim msg,founderr

msg=""
founderr=false
EnableUpload=false
SavePath = SaveUpFilesPath5   '存放上传文件的目录
if right(SavePath,1)<>"/" then SavePath=SavePath&"/" '在目录后加(/)
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<%
if EnableUploadFile="No" then
	response.write "系统未开放文件上传功能"
else
	if session("users")="" then
		response.Write("请登录后再使用本功能!")
	else
		select case upload_type
			case 0
				call upload_0()  '使用化境无组件上传类
			case else
				'response.write "本系统未开放插件功能"
				'response.end
		end select
	end if
end if
%>
</body>
</html>
<%
else
 response.write "<script language=JavaScript>" & chr(13) & "alert('产品编号必须填写!');" & "history.back()" & "</script>"
end if
%>

<%
sub upload_0()    '使用化境无组件上传类
	set upload=new upload_file    '建立上传对象
	for each formName in upload.file '列出所有上传了的文件
		set file=upload.file(formName)  '生成一个文件对象
		if file.filesize<100 then
 			msg="请先选择你要上传的文件!"
			founderr=true
		end if
		if file.filesize>(MaxFileSize*1024) then
 			msg="文件大小超过了限制,最大只能上传" & CStr(MaxFileSize) & "K的文件!"
			founderr=true
		end if

		fileExt=lcase(file.FileExt)
		Forumupload=split(UpFileType2,"|")
		for i=0 to ubound(Forumupload)
			if fileEXT=trim(Forumupload(i)) then
				EnableUpload=true
				exit for
			end if
		next
		if fileEXT="asp" or fileEXT="asa" or fileEXT="aspx" then
			EnableUpload=false
		end if'安全性能的保证
		if EnableUpload=false then
			msg="这种文件类型不允许上传!\n\n只允许上传这几种文件类型:" & UpFileType2
			founderr=true
		end if
		
		strJS="<SCRIPT language=javascript>" & vbcrlf
		if founderr<>true then
			randomize
			ranNum=int(900*rnd)+100
			fileexistpath=SavePath
			'filetruename=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum&"."&fileExt
			filetruename=request.QueryString("No")
			filename=fileexistpath&filetruename&"."&fileExt 
		'自动生成文件名字	'filename=SavePath&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum&"."&fileExt

			file.SaveToFile Server.mappath(FileName)   '保存文件

			msg="上传文件成功!"
			
		end if
'2级父类
        strJS=strJS & "parent.parent.myform.testPic5.value='"& filename & "';" & vbcrlf
		strJS=strJS & "parent.parent.myform.testPic5_doc.value='" & filename & "';" & vbcrlf
		strJS=strJS & "parent.parent.myform.testPic5_doc_path.value='" & fileexistpath & "';" & vbcrlf
		strJS=strJS & "parent.parent.myform.testPic5_doc_ext.value='" & fileExt & "';" & vbcrlf
        if not founderr then
		strJS=strJS & "parent.parent.testPic5_doc_link.innerHTML='<a href=" & filename & " target=_blank><font color=#ff0000>√已添加</font></a>';" & vbcrlf
		end if
'修改父类的页面HTML		
strJS=strJS & "alert('" & msg & "');" & vbcrlf
	  	strJS=strJS & "history.go(-1);" & vbcrlf
	  	strJS=strJS & "</script>"
	  	response.write strJS
		set file=nothing
	next
	set upload=nothing
	'response.redirect "upload_goods.asp"
	
end sub
%>

⌨️ 快捷键说明

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