Thanks Les. Hopefully I am considered a KIXTer.
Running KIX v4.22 W2kPro
I tried changes as follows (See CODE below).
ERROR
2567/80020009 ]f acceptable range, or are in conflict with one another.) [-2147354
ERROR
The error appears to be truncated. Is this due to my code or something else?
It would also help me if someone could clarify what exactly is happening here.
Code:
$oStream.Write($oFTP.responseBody)
Code:
BREAK ON CLS
$ = FTPGET("ftp://svr.domain.com/share/test.txt","C:\_ftp\test.txt","domain\user","password")
?$
FUNCTION FTPget($sURL, $sTargetFile, optional $sUser, optional $sPass)
DIM $oFTP, $oStream
$sUser=""+$sUser
$oFTP = CREATEOBJECT("Microsoft.XMLHTTP")
IF @error $ftpget=1 EXIT 1 ENDIF
$oStream = CREATEOBJECT("ADODB.Stream")
IF @error $ftpget=2 EXIT 2 ENDIF
IF $sUser
$oFTP.Open("GET", $sURL, not 1, $sUser, $sPass)
ELSE
$oFTP.Open("GET", $sURL, not 1)
ENDIF
IF @error $ftpget=3 EXIT 3 ENDIF
$oFTP.Send
;Set transfer as binary
$oStream.Type = 1
;Prevents others from opening a connection with read permissions.
$oStream.Mode = 3
$oStream.open
;? "SERROR: @SERROR"
$oStream.Write($oFTP.responseBody)
IF @error $ftpget=4 ? "SERROR: @SERROR" EXIT 4 ENDIF
$oStream.SaveToFile($sTargetFile, 2)
IF @error $ftpget=5 EXIT 5 ENDIF
$oStream.Close
ENDFUNCTION