Hospital Posted July 29, 2015 Posted July 29, 2015 (edited) Hi guys, the script does upload the text file, but it will not read it in msgbox? I don't see why, and I've been trying... any idea why? #RequireAdmin #include <FTP.au3> #include <FTPEx.au3> $server = "ftp.stole--private" $username = "--private" $pass = "--private" $Open = _FTPOpen("--private") consolewrite( "Open: " & $Open & @crlf ) $Conn = _FTPConnect($Open, $server, $username, $pass) consolewrite( "Connect: " & $Conn & @crlf ) ;we are connected. $Ftpp = _FtpPutFile($Conn, @ScriptDir&"\TotalPurchases.txt", "TotalPurchases.txt") consolewrite( "Put Result: " & $Ftpp & @crlf ) ; reading it (this is where it stops working and returns blank.) $ftpfileopen = _FTP_FileOpen($Conn,"\TotalPurchases.txt") Local $ftpfile = _FTP_FileRead($ftpfileopen,100000) Global $convertstring = BinaryToString($ftpfile) msgbox(1,"read",$convertstring) $Ftpc = _FTPClose($Open) Edited July 29, 2015 by Hospital
Hospital Posted August 2, 2015 Author Posted August 2, 2015 I don't see what's wrong with it.I can do FilePut with $conn but I can't FileRead?
kaisies Posted August 2, 2015 Posted August 2, 2015 (edited) Add error checking for_ftp_fileopen. Clearly it's failing. Editor or _ftp_fileread Edited August 2, 2015 by kaisies
PACaleala Posted August 3, 2015 Posted August 3, 2015 What did you do to "see what's wrong with it" ?
PACaleala Posted August 5, 2015 Posted August 5, 2015 Read the AutoIt Help file andyou should learn that the functions _FTPConnect and _FTP_FileOpen return handles meaning two different things:If you still want to make it work you will have to modify your udf.
AutoBert Posted August 5, 2015 Posted August 5, 2015 This works for me:#include <FTPEx.au3> $server = "127.0.0.1" $username = "Bert" $pass = "Test" $Open = _FTP_Open("--private") consolewrite( "Open: " & $Open & @crlf ) $Conn = _FTP_Connect($Open, $server, $username, $pass) consolewrite( "Connect: " & $Conn & @crlf ) ;we are connected. $Ftpp = _FTP_FilePut($Conn, @ScriptDir&"\FTP_FileRead.au3", "FTP_FileRead.au3") consolewrite( "Put Result: " & $Ftpp & @crlf ) ; reading it(this is where it stops working and returns blank.) $ftpfileopen = _FTP_FileOpen($Conn,"\FTP_FileRead.au3") Local $ftpfile = _FTP_FileRead($ftpfileopen,100000) Global $convertstring = BinaryToString($ftpfile) msgbox(1,"read",$convertstring) _FTP_Close($Conn) _FTP_Close($Open)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now