我正在尝试使用ADO发送文件。但它总是给出相同的错误(800A0BBA)。
Dim strURL, HTTP, dataFile, dataRequest, tmpDir
Dim objStream
Set objShll = WScript.CreateObject("WScript.Shell")
tmpDir = objShll.ExpandEnvironmentStrings("%temp%") & "\"
strURL = "https://www.example.org/accept.php"
Set HTTP = CreateObject("Microsoft.XMLHTTP")
Set objStream = CreateObject("ADODB.Stream")
objStream.Type = 1
objStream.Open
objStream.LoadFromFile tmpDir & "123123.file" '<<< The error points on this line.
set dataFile = objStream.Read
set dataRequest = "dataFile=" & dataFile
HTTP.open "POST", strURL, False
HTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
HTTP.setRequestHeader "Content-Length", Len(dataRequest)
HTTP.send dataRequest
我用不同的位置检查了文件的存在和权限几次。写了不同方式的路径,仍然得到错误。