Jump to content

UDF FTP upload text file problem


Recommended Posts

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

Link to comment
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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...