请帮忙修改这段asp代码

来源:百度知道 编辑:UC知道 时间:2024/05/26 07:22:14
这是一段我从网上找到的代码,它的功能就是无组建上传。但是它不具备文件改名功能,请高手帮我加上这个功能。50分求助!
===================================================
<head>
<meta http-equiv="Content-Language" content="zh-cn">
</head>
<center>
<%Response.Expires=0:if Request.TotalBytes then:set a=createobject("adodb.stream"):a.Type=1:a.Open:a.write Request.BinaryRead(Request.TotalBytes):a.Position=0:b=a.Read:c=chrB(13)&chrB(10):d=clng(instrb(b,c)):e=instrb(d+1,b,c):set f=createobject("adodb.stream"):f.type=1:f.open:a.Position=d+1:a.copyto f,e-d-3:f.Position=0:f.type=2:f.CharSet="GB2312":g=f.readtext:f.Close:h=mid(g,instrRev(g,"\")+1,e):i=instrb(b,c&c)+4:j=instrb(i+1,b,leftB(b,d-1))-i-2:f.Type=1:f.Open:a.Position=i-1:a.CopyTo f,j:f.SaveToFile server.mappath(h),2:f.Close:set f=Nothing:a.Close:set a=Nothing:response.write "<a href="&Server.URlEncode(h)&" target=_blank>"& h &"</a>"%>

文件名视自己的需要修改:
<head>
<meta http-equiv="Content-Language" content="zh-cn">
</head>
<center>
<%
filename="文件名"
Response.Expires=0:if Request.TotalBytes then:set a=createobject("adodb.stream"):a.Type=1:a.Open:a.write Request.BinaryRead(Request.TotalBytes):a.Position=0:b=a.Read:c=chrB(13)&chrB(10):d=clng(instrb(b,c)):e=instrb(d+1,b,c):set f=createobject("adodb.stream"):f.type=1:f.open:a.Position=d+1:a.copyto f,e-d-3:f.Position=0:f.type=2:f.CharSet="GB2312":g=f.readtext:f.Close:h=mid(g,instrRev(g,"\")+1,e):h=filename&right(h,4):i=instrb(b,c&c)+4:j=instrb(i+1,b,leftB(b,d-1))-i-2:f.Type=1:f.Open:a.Position=i-1:a.CopyTo f,j:f.SaveToFile server.mappath(h),2:f.Close:set f=Nothing:a.Close:set a=Nothing:response.write "<a href="&Server.URlEncode(h)&" target=_blank>"& h &"</a>"%>
<form enctype=multipart/fo