rudolph Posted May 14, 2008 Posted May 14, 2008 Hi all:I am using UDF FTP.au3, to upload a text file from windows Xp sp2 to unix ftp server,the scrip is running well but I found a BIG PROBLEM, maybe a BUG in FTP.au3 when the filetest.txt is uploaded, the file was changed and added a carriage return(CR) and a line feed (LF) for ,for each line . Someone can tell me what is wrong with my script or is a FTP.au3 BUG?Please I need a HELP on this ?CR=carriage return LF=Line feedFor example , original file test.txt looks like this:aaaaaaaaaaaaabbbbbbbbb123456CRbbbbbbbbbbbbbbbbbbbbbbbbbbbbCRddddddddddddddddddddddddddddCRThe new uploaded file test.txt looks like this (Inserted CR andLF for each line):aaaaaaaaaaaaabbbbbbbbbccccccCRCRLFbbbbbbbbbbbbbbbbbbbbbbbbbbbbCRCRLFddddddddddddddddddddddddddddCRCODEOpt ("ExpandEnvStrings", 0)Opt ("ExpandVarStrings", 1)Opt ("MustDeclareVars", 1);;#include <GUIConstants.au3>#include <FTP.au3>Dim $server = "ftp.test.com"Dim $username = "usr"Dim $pass = "passw"Dim $port = 21Dim $dllhandle = DllOpen('wininet.dll')Dim $Open = _FTPOpen('MyFTP')if @error ThenMsgBox(0, "", "fail_open")ExitEndIfDim $Conn = _FTPConnect($Open, $server, $username, $pass, $port)If @error ThenMsgBox(0, "", "fail_Connect")ExitEndIfDim $Ftpp = _FtpPutFile($Conn, 'C:\TEMP\test.txt', '/test.txt')If @error ThenMsgBox(0, "", "fail_PutFile")ExitEndIfDim $Ftpc = _FTPClose($Open)If @error ThenMsgBox(0, "", "fail_Close")ExitEndIfDllClose($dllhandle)MsgBox(0,"FTP PUT File - Status ", ""$Ftpc = " & $Ftpc" & "$Open = " & $Open & @CRLF & "$Conn = " & $Conn & @CRLF & "$Ftpp = " & $Ftpp & @CRLF & "$Ftpc = " & $Ftpc )Exit
erezlevi Posted May 14, 2008 Posted May 14, 2008 hi, try using; FTP_TRANSFER_TYPE_BINARY under $l_Flags. instead of using ASCII transfer.
erezlevi Posted May 15, 2008 Posted May 15, 2008 oh, I am sorry just read inside MSDN, Binary is the default, so you need to choose ASCII!
rudolph Posted May 15, 2008 Author Posted May 15, 2008 oh, I am sorry just read inside MSDN, Binary is the default, so you need to choose ASCII!Excellent Erezlevi:Normally the default is ASCII, but in this case was BINARY extrange.Anyway, I passed the flag ascii and It works .Thank you very much for your help.
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