The ContentToFile method outputs the content of the request to the specified file. The OCX host program must have permission to access this file. Binary (images, pdf files etc) or text data are all OK. This method is specifically optimised for speed.
Syntax
ContentToFile(fileName, overWrite, append)
Parameters
Return Values
Empty if successful, otherwise an error message indicating the problem.
Example
The following requests a URL and outputs the content to a file:
<% Set OCXHttp = Server.CreateObject("OCXHTTP.OCXHttpCtrl.1") %>
<%
result = OCXHttp.GET("http://www.flicks.com/scripts/debug.asp")
%>
<% If "" = result Then %>
Succesfully requested file.
<%
saveToFileName = "c:\outputFile.htm"
toFileResult = OCXHttp.ContentToFile(saveToFileName,0,0)
if ("" = toFileResult) Then
response.Write("Saved to file " & saveToFileName)
else
response.Write("Could not save to file " & saveToFileName & " error is " & toFileResult)
End if
%>
<% Else %>
Could not request file because: <%= result %>
<% End If %>
Applies To