这个问题我问了好几次,好像没有人回答清楚!
xdszg 2004-01-08 11:18:15 贴出我的代码!
test1.asp
<html>
<head>
<title>copytest</title>
</head>
<!--#INCLUDE FILE="COMMON1.asp"-->
<body>
<h1>file choose</h1>
<FORM METHOD="POST" action="t.asp" name="form1">
<INPUT TYPE="FILE" NAME="fromfile" size=60>
<INPUT TYPE="button" VALUE="Send" name="send" onclick="Setei">
</FORM>
<p>
</body>
<script language="vbscript">
Sub Setei()
dim i
dim aaa
dim bbb
aaa = form1.fromfile.value
bbb= "\\172.28.121.49\income"
msgbox(aaa)
msgbox(bbb)
i = UploadFile(aaa,bbb)
msgbox(i)
form1.Submit()
End Sub
</script>
</html>
COMMON1.asp
<script language="vbscript">
Function UploadFile(src,dest)
UploadFile = 0
On Error Resume Next
Err.Clear
Dim lsrc1
Dim fso
Dim lenth
Dim inttmp
Dim strtmp
Dim i
inttmp = 0
strtmp = ""
Set fso = CreateObject("Scripting.FileSystemObject")
if Right(src,1) = "\" then
lsrc1 = Left( src , Len(src) - 1 )
else
lsrc1 = src
end if
lenth = len(lsrc1)
if lenth > 0 then
for i =1 to lenth
strtmp = Mid(lsrc1,lenth-i,1)
if strtmp = "\" then
strtmp = Right(lsrc1,i+1)
exit for
end if
next
end if
if len(strtmp) > 0 then
strtmp = dest & strtmp
else
UploadFile = 0
exit Function
end if
fso.CopyFile lsrc1,strtmp
Set fso = Nothing
if Err.Number <> 0 then
UploadFile = 0
else
UploadFile = 1
end if
End Function
</script>
运行提示:COMMON1.asp的
Set fso = CreateObject("Scripting.FileSystemObject")
出错。
信息:Active控件的对象不能做成.
我折腾了好久都不行,是什么原因?
解决了再送100分。