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

📄 upfile.asp

📁 天创商务网客户资源管理系统 v1,asp+Access,iis5
💻 ASP
字号:
<!--#include file = include.asp-->
<%Server.ScriptTimeOut=5000%>
<!--#include FILE="upload.inc"-->
<html>
<head>
<title>图片上传</title>
</head>
<body>
<%
dim upload,file,formName,formPath,iCount,time1,time2,msg
set upload=new upload_5xsoft ''建立上传对象

formPath="../upfile/"

upType=upload.form("upType")
month1=month(now)
if Month1<10 then Month1="0"&Month1
day1=day(now)
if day1<10 then day1="0"&day1
hour1=hour(now)
if hour1<10 then hour1="0"&hour1
minute1=minute(now)
if minute1<10 then minute1="0"&minute1
second1=second(now)
if second1<10 then second1="0"&second1

Domain=Request.ServerVariables("SERVER_NAME")
gFilePath=Request.ServerVariables("PATH_INFO")
gFilePath=lcase(left(gFilePath,instrRev(gFilePath,"/")))
CountN=len(gFilePath)
gFilePath=lcase(left(gFilePath,CountN-1))
gFilePath=lcase(left(gFilePath,instrRev(gFilePath,"/")))
AllPath="http://"&Domain&gfilepath

'response.write AllPath
'response.end

set rs=conn.execute("select ConfineFile,FileSize from Config")
ConfineFile=rs(0)
FileSize=rs(1)
rs.close
set rs=nothing
iCount=0
msg=""
for each formName in upload.objFile ''列出所有上传了的文件
  month1=month(now)
  if Month1<10 then Month1="0"&Month1
  day1=day(now)
  if day1<10 then day1="0"&day1
  hour1=hour(now)
  if hour1<10 then hour1="0"&hour1
  minute1=minute(now)
  if minute1<10 then minute1="0"&minute1
  second1=second(now)
  if second1<10 then second1="0"&second1
  FileName=Year(now)&Month1&Day1&Hour1&Minute1&Second1&"-"&iCount
 set file=upload.file(formName)  ''生成一个文件对象
 FileName1=Year(now)&Month1&Day1&Hour1&Minute1&Second1&"-"&iCount
 FileExt = lcase(right(file.FileName,3))
 if file.FileSize>0 then
  FileNum=split(ConfineFile,",")
  FindFile=false
  for i=0 to UBound(FileNUM)
    if FileExt=lcase(trim(FileNum(i))) then
      FindFile=true
      exit for
    end if
  next
  if file.FileSize>FileSize*1000 then
    msg=msg&"<font color=red>文件"&iCount&":上传失败原因:超过系统设置文件大小</font><br>"
  elseif FindFile=false or FileExt="asp" or FileExt="exe" then
    msg=msg&"<font color=red>文件"&iCount&":上传失败原因:系统不允许此类型文件</font><br>"
  else
    file.SaveAs Server.mappath(""&formPath&FileName1&"."&FileExt)
	if upType<>"News" then
	  msg=msg&"文件"&iCount&":上传成功<br>"
	else
	  if FileExt="jpg" or FileExt="gif" or FileExt="png" then
	    msg=msg&"文件"&iCount&":上传成功&nbsp;&nbsp;<a href=# onclick=""Addpic('"&AllPath&"upfile"&"/"&FileName1&"."&fileext&"')""><font color=#ff0000>点击添加到编辑器中</font></a>&nbsp;&nbsp;<a href="&AllPath&"upfile"&"/"&FileName1&"."&fileext&" target=_blank>"&FileName1&"."&FileExt&"</a><br><font color='#c0c0c0'>路径:"&AllPath&"upfile"&"/"&FileName1&"."&fileext&"</font><br>"
	  else
	    msg=msg&"文件"&iCount&":上传成功&nbsp;&nbsp;<a href="&AllPath&"upfile"&"/"&FileName1&"."&fileext&" target=_blank>"&FileName1&"."&FileExt&"</a><br><font color='#c0c0c0'>路径:"&AllPath&"upfile"&"/"&FileName1&"."&fileext&"</font><br>"		
	  end if
	end if
  end if
  iCount=iCount+1
 end if
 set file=nothing
next

set upload=nothing  ''删除此对象
if upType<>"News" then
response.write msg&"<a href=NUpload.asp>继续上传</a>"
else
response.write msg&"<a href=NUpload.asp>继续上传</a>"
end if
%>
</body>
</html>

⌨️ 快捷键说明

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