标题:[求助]FSO组件能上传吗文件吗???
取消只看楼主
utfqqrsf
Rank: 1
等 级:新手上路
帖 子:85
专家分:0
注 册:2005-12-28
 问题点数:0 回复次数:1 
[求助]FSO组件能上传吗文件吗???
如题~~~如果能的话具体应该怎样做???

最好能给出代码^_^

先谢过了
搜索更多相关主题的帖子: FSO 组件 文件 
2007-08-17 15:52
utfqqrsf
Rank: 1
等 级:新手上路
帖 子:85
专家分:0
注 册:2005-12-28
得分:0 

[CODE]<%
a=Request.TotalBytes
if a>0 Then
Set c=Createobject("adodb.stream")
c.Type=1
c.Open
c.Write Request.BinaryRead(a)
c.Position=0

d=c.Read
e=chrB(13)&chrB(10)
f=Instrb(d,e)
g=Instrb(f+1,d,e)

set h=Createobject("adodb.stream")
h.Type=1
h.Open
c.Position=f+1
c.Copyto h,g-f-3
h.Position=0
h.type=2
h.CharSet="BIG5"
i=h.Readtext
h.close

j=mid(i,InstrRev(i,"\")+1,g)

if instr("jsp/asp/aspx/exe/php/html/htm/...",right(j,len(j)-instr(j,".")))>0 then
session("error")="您要上传不允许的文件"
response.redirect("error.asp")
end if

j=replace(date,"-","")&right(j,len(j)-instr(j,".")+1)

set fso=server.createobject("scripting.filesystemobject")
if fso.FileExists(server.mappath(j)) then
i=1
msg=true
do while msg
m=left(j,instr(j,".")-1)&"("&i&")"&right(j,len(j)-instr(j,".")+1)
if not fso.FileExists(server.mappath(m)) then
j=m
msg=false
end if
i=i+1
loop
end if
set fso=nothing


k=Instrb(d,e&e)+4
l=Instrb(k+1,d,leftB(d,f-1))-k-2
h.Type=1
h.Open
c.Position=k-1
c.CopyTo h,l
h.SaveToFile server.mappath(j),2
end if
%>
<form enctype=multipart/form-data method=post>
<input type=file name=n />
<input name="submit" type=submit value="提交" />
</form> [/CODE]

这是我刚才在网上找到的代码...可以上传啊~~~
但我看不明~~~上传之后的文件都是以系统日期命名的,后缀没变
能解释一下吗??


2007-08-17 16:27



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-163496-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.750842 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved