Sign in to follow this  
Followers 0
rudolph

UDF FTP upload text file problem

4 posts in this topic

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 file

test.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 feed

For example , original file test.txt looks like this:

aaaaaaaaaaaaabbbbbbbbb123456CR

bbbbbbbbbbbbbbbbbbbbbbbbbbbbCR

ddddddddddddddddddddddddddddCR

The new uploaded file test.txt looks like this (Inserted CR and

LF for each line):

aaaaaaaaaaaaabbbbbbbbbccccccCR

CR

LFbbbbbbbbbbbbbbbbbbbbbbbbbbbbCR

CR

LFddddddddddddddddddddddddddddCR

CODE
Opt ("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 = 21

Dim $dllhandle = DllOpen('wininet.dll')

Dim $Open = _FTPOpen('MyFTP')

if @error Then

MsgBox(0, "", "fail_open")

Exit

EndIf

Dim $Conn = _FTPConnect($Open, $server, $username, $pass, $port)

If @error Then

MsgBox(0, "", "fail_Connect")

Exit

EndIf

Dim $Ftpp = _FtpPutFile($Conn, 'C:\TEMP\test.txt', '/test.txt')

If @error Then

MsgBox(0, "", "fail_PutFile")

Exit

EndIf

Dim $Ftpc = _FTPClose($Open)

If @error Then

MsgBox(0, "", "fail_Close")

Exit

EndIf

DllClose($dllhandle)

MsgBox(0,"FTP PUT File - Status ", ""$Ftpc = " & $Ftpc" & "$Open = " & $Open & @CRLF & "$Conn = " & $Conn & @CRLF & "$Ftpp = " & $Ftpp & @CRLF & "$Ftpc = " & $Ftpc )

Exit

Share this post


Link to post
Share on other sites



hi,

try using;

FTP_TRANSFER_TYPE_BINARY

under $l_Flags.

instead of using ASCII transfer.

Share this post


Link to post
Share on other sites

oh, I am sorry just read inside MSDN, Binary is the default, so you need to choose ASCII!

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0