无效的过程调用或参数在VBScript
我使用VB脚本上传文件到服务器。我遇到的问题是,当我设置文件,这样的ASCII格式...无效的过程调用或参数在VBScript
Set oFile = oFS.CreateTextFile(sPath & FileName, True, False)
我得到一个错误,当子叫,说
无效的过程调用或参数
,但如果我设置文件为Unicode
Set oFile = oFS.CreateTextFile(sPath & FileName, True, True)
它上传成功但由于编码不正确而无法打开。 产生错误的线是这一个,如果格式是ASCII是这个
oFile.Write BinaryToString(FileData)
其中oFile
是我上述
创建的ASCII文件在这里是产生错误的源代码。这是一个上传功能,我下车净..
Public Sub SaveToDisk(sPath)
Dim oFS, oFile
Dim nIndex
If sPath = "" Or FileName = "" Then Exit Sub
If Mid(sPath, Len(sPath)) <> "\" Then sPath = sPath & "\"
Set oFS = Server.CreateObject("Scripting.FileSystemObject")
If Not oFS.FolderExists(sPath) Then Exit Sub
Set oFile = oFS.CreateTextFile(sPath & FileName, True, False)
oFile.Write BinaryToString(FileData)
oFile.Close
End Sub
Function BinaryToString(Binary)
'Antonin Foller, http://www.motobit.com
'Optimized version of a simple BinaryToString algorithm.
Dim cl1, cl2, cl3, pl1, pl2, pl3
Dim L
cl1 = 1
cl2 = 1
cl3 = 1
L = LenB(Binary)
Do While cl1<=L
pl3 = pl3 & Chr(AscB(MidB(Binary,cl1,1)))
cl1 = cl1 + 1
cl3 = cl3 + 1
If cl3>300 Then
pl2 = pl2 & pl3
pl3 = ""
cl3 = 1
cl2 = cl2 + 1
If cl2>200 Then
pl1 = pl1 & pl2
pl2 = ""
cl2 = 1
End If
End If
Loop
BinaryToString = pl1 & pl2 & pl3
End Function
难道是在服务器上配置?如果这使得任何意义,请帮助..
我怀疑BinaryToString不是只返回ASCII(实际上目前的OEM代码页)的字符,而且在Unicode范围内的其他字符是OEM代码页设置之外。
这到底是什么BinaryToString吗?
Function BinaryToString(Binary) \t \t'Antonin Foller,http://www.motobit.com \t \t'简单BinaryToString算法的优化版本。 \t \t \t \t昏暗CL1,CL2,CL3,PL1,PL2,PL3 \t \t昏暗大号 \t \t CL1 = 1 \t \t CL2 = 1 \t \t CL3 = 1 \t \t L = LENB(二进制) \t \t \t \t的do while CL1 300然后 \t \t \t \t PL2 = PL2 PL3& \t \t \t \t PL3 = “” \t \t \t \t CL3 = 1 \t \t \t \t CL2 = CL2 + 1 \t \t \t \t如果CL2> 200然后 \t \t \t \t \t PL1 = PL1及PL2 \t \t \t \t \t PL2 = “” \t \t \t \t \t CL2 = 1 \t \t \t \t End If \t \t \t结束如果 \t \t环 \t \t BinaryToString = PL1和PL2和PL3 \t端功能 – Kwah009 2009-07-01 14:25:28
不合理长的时间来处理同样的问题,没有实拍有意义的我,并没有涉及到Unicode后,我终于得到它一起工作:
Set oFile = oFS.CreateTextFile(sPath & FileName, 8)
这页的对我有用: http://ns7.webmasters.com/caspdoc/html/vbscript_filesystemobject_object_opentextfile_method.htm
伊利亚·叶夫多基莫夫
中的FileData举行哪些数据类型以及它是如何在第一时间获得? – AnthonyWJones 2009-07-01 14:46:12