送交者: bluesea 于 2005-8-18, 08:22:45:
我和这位仁兄有一样的问题,谁能帮着解答:
I have this project requirement where in I have to copy pdf / word documents from one webserver hosted on IIS to another web server also hosted on IIS.
I tried doing this with the following code in asp:
Dim sSource, sDest, oHTTP, stream
sSource = "http://server1/website1/test.pdf"
sDest = "Test\test2.pdf"
set oHTTP = CreateObject("Microsoft.XMLHTTP")
oHTTP.open "GET", sSource, False
oHTTP.send
const adTypeBinary = 1
const adSaveCreateOverwrite = 2
const adModeReadWrite = 3
set stream = createobject("adodb.stream")
stream.type = adTypeBinary
stream.mode = adModeReadWrite
stream.open
stream.write oHTTP.responseBody
stream.savetofile sDest, adSaveCreateOverwrite
stream.close
set oHTTP = nothing
set stream = nothing
This copies the file from server1 and puts it into test\ folder on my local drive.
When i repplace the sDest with http://server2/website2/test2.pdf ,I get the the following message:
Error: Write to file failed
Code: 800A0BBC
Source: ADODB.Stream
Any clues as to where I am going wrong? or any poiter as to how i can do this job alternatively?