travisbrown
Technical User
- Dec 31, 2001
- 1,016
I'd built a little application for a client that spools selected files to another server using an xmlhttp request.
Originally they'd provided an environment with links to files and everything was working fine. Now for production they suddenly pull out fileserver references that of course break everything.
These docs are called from the fileserver as such:
ViewByDocument.do?guid={111EC1D0-D69F-4F76-9D5C-C484C93CAD6A}
And cause this error:
ADODB.Stream error '800a0bbc'
Write to file failed.
on this line:
Call stream.Write(xmlHttp.responseBody)
I need an alternative method in a hurry. Any suggestions?
Originally they'd provided an environment with links to files and everything was working fine. Now for production they suddenly pull out fileserver references that of course break everything.
These docs are called from the fileserver as such:
ViewByDocument.do?guid={111EC1D0-D69F-4F76-9D5C-C484C93CAD6A}
And cause this error:
ADODB.Stream error '800a0bbc'
Write to file failed.
on this line:
Call stream.Write(xmlHttp.responseBody)
I need an alternative method in a hurry. Any suggestions?
Code:
FUNCTION StreamFile(path,target,files)
DIM arr_files()
iteration = 0
FOR EACH file IN files
filename = GetFileName(file)
Dim xmlHttp
Set xmlHttp = Server.CreateObject("MSXML2.ServerXMLHTTP")
Call xmlHttp.open("GET", path)
Call xmlHttp.send()
Dim stream
Set stream = Server.CreateObject("ADODB.Stream")
stream.Type = adTypeBinary
Call stream.Open()
Call stream.Write(xmlHttp.responseBody)
Call stream.SaveToFile(target & "\" & filename,
adSaveCreateOverWrite)
Call stream.Close()
Set stream = Nothing
Set xmlHttp = Nothing
REDIM PRESERVE arr_files(iteration)
arr_files(iteration) = filename
iteration = iteration + 1
NEXT
StreamFile = arr_files
END FUNCTION