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

📄 editsave.asp

📁 asp程序,自动投稿系统,也可以用来学生交作业,原创程序.
💻 ASP
字号:

<%
ID=session("edit_id")
session("edit_id")=""
if id="" then
	response.Write "<script langurage=javascript> alert('对不起, 您没有访问权限!')</script>"
	response.End
end if
%>
<!--#include FILE="clsUp.asp"-->
<!--#include file="conn.asp"-->
<%
Server.ScriptTimeout=600
dim upfile,formPath,ServerPath,FSPath,FileName,newFilename,path,objfso,sql,rs,conn

set upfile=new clsUp ''建立上传对象
upfile.NoAllowExt="asp;exe;htm;html;aspx;cs;vb;js;"	'设置上传类型的黑名单
upfile.GetData (102400000)   '取得上传数据,限制最大上传10M

%>
<html>
<head>
<title>文件上传</title>
<style type="text/css">
<!--
.p9{ font-size: 9pt; font-family: 宋体 }
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body leftmargin="20" topmargin="20" class="p9">
<%

if upfile.isErr then  '如果出错

    select case upfile.isErr
	case 1
	Response.Write "请上传修改后稿件"
	case 2
	Response.Write "你上传的文件超出我们的限制,最大10M"
	end select
	else
%>

<%
	FSPath=GetFilePath(Server.mappath("upfile.asp"),"\")'取得当前文件在服务器路径
	ServerPath=GetFilePath(Request.ServerVariables("HTTP_REFERER"),"/")'取得在网站上的位置
	
	

	
	   FileName=upfile.file("file").filename'原来的文件名
	   newfilename=upfile.AutoSave("file",FSPath&"upload\"&FileName)   ''保存文件 也可以使用SaveToFile来保存,参数一样,但是不会自动建立新的文件名
	 %>
<%
    	if upfile.iserr then 
			Response.Write upfile.errmessage
		else
					
			
				sql="select * from file where id="&id
				rs.open sql,conn,1,3
			rs("oldfilename")=rs("filename")
			rs("filename")=newfilename
			rs("zt")=7
			rs("olddate")=rs("date")
			rs("date")=date()'=在数据库里插入当前的时间,格式为年,月,日			
			rs.update
			
			
			set upfile=nothing '删除此对象
			response.Redirect("login_ok.asp")
			


		end if
		
end if

%>




</body>
</html>

<%
function GetFilePath(FullPath,str)
  If FullPath <> "" Then
    GetFilePath = left(FullPath,InStrRev(FullPath, str))
    Else
    GetFilePath = ""
  End If
End function
%>

⌨️ 快捷键说明

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