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

📄 downloadmanageeditsave.asp

📁 这个也是一个功能强大的企业整站的ASP源代码
💻 ASP
字号:
<!--#include file="CheckAdminLogined.asp"-->
<!--#include file="../include/connstr.asp"-->
<!--#include file="../Include/CnpvUpFile.inc"-->
<!--#include file="../include/DefFunction.asp"-->
<%
 dim upload,file1,file2,formName,formPath,T_comment,fso
 set upload=new upload_5xSoft ''建立上传对象
 if not isdate(upload.form("T_AddTime")) then
   response.write "<script>alert('错误的时间格式,请重新填写!');history.back();</script>"
   response.end
 end if

 set rs_oldFile=conn.execute("select * from tDownLoad where ID="&upload.form("EditID")) '把原来的产品图片读出来,以便更换删除
 OldDownFile=rs_oldFile("DownFile")
 
 FileName1=OldDownFile
 
 set file1=upload.file("T_DownFile")  ''生成一个文件对象
  if trim(file1.FileName)<>"" then 
    if file1.FileSize>4000000 then 
      response.write "<script>alert('产品图片不能大于4M!');history.back();</Script>" 
      response.End()
    else                         	   
       formPath="/UploadFile/Download"'得到上传目录
	   if right(formPath,1)<>"/" then formPath=formPath&"/"  ''在目录后加(/)					 
					  
       if file1.FileSize>0 then '如果有产品图片存在,保存判断是否要删除原先的图片
	     FileName1=makefilename()&"_Pic."&GetExtendName(file1.FileName)
		 file1.SaveAs Server.mappath(formPath&FileName1)
			  			  
 	     if (OldDownFile<>"") then
             delfname=server.mappath(formPath) & "/" & OldDownFile
             set TestFileObject=Server.Createobject("Scripting.FileSystemObject")
             if  TestFileObject.FileExists(delfname) then
                set NewFile=TestFileObject.getfile(delfname)
                Newfile.delete
             end if
          end if   '与删除图片对应
   	   end if '与判断file1>0对应
    end if
  end if '与判断file1,file2是否为空对应

  '--------------------------------------------删除无用的文件或图片
  Set fso = CreateObject("Scripting.FileSystemObject")
  arrUploadFiles=split(upload.form("UploadFile"),"$")
  UploadFile=""

  for intTemp=0 to ubound(arrUploadFiles)
    if instr(upload.form("Content"),arrUploadFiles(intTemp))<=0 then
      strRubbishFile=server.MapPath("/UploadFile/Download/" & arrUploadFiles(intTemp))
      if fso.FileExists(strRubbishFile) then
        fso.DeleteFile(strRubbishFile)
      end if
    else
      if intTemp=0 then
         UploadFile=arrUploadFiles(intTemp)
      else
         UploadFile=UploadFile & "$" & arrUploadFiles(intTemp)
      end if
    end if
  next
 

 set file1=nothing
 conn.execute("update tDownload set Title='"&upload.form("T_Title")&"',ClassID='"&upload.form("S_ClassID")&"',Content='"&MyRequest(upload.form("Content"))&"',DownFile='"&FileName1&"',UploadFile='"&UploadFile&"',AddTime='"&upload.form("T_AddTime")&"' where ID="&upload.form("EditID"))
 
 response.write "<script>alert('恭喜您,修改已经成功完成!');location.replace('DownLoadManage.asp?Key="&upload.form("Key")&"&PageNo="&upload.form("PageNo")&"&ClassID="&upload.form("ClassID")&"&ClassName="&upload.form("ClassName")&"');</script>"
 set upload=nothing 
 %>

⌨️ 快捷键说明

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