+1 vote

Problem Facing - I am setting the transfer type as “base.TransfersDataType = FtpDataType.Ebcdic;” . After this, I am using following command to transfer file from local to mainframe.

base.Upload(strRemoteFile, strLocalFile);

But the problem is that, it is transferring file in Binary Mode only. Even if I set the TransferDataType as ‘FtpDataType.Ascii’, even then it is using the Binary mode only i.e. ‘I’.

I checked it after setting the transferdatatype to EBCDIC or ASCII, in debug mode, it show the “base.TransfersDataType” as Binarymode only.

Can you please check, why is it so? OR Am I using it somehow differently?

by

1 Answer

0 votes
 
Best answer

Ftp.TransfersDataType works properly. please note that TYPE A command is send before first transfer and TYPE I before the next:

Unit test:

ftpClient.TransfersDataType = FtpDataType.Ascii;
ftpClient.Upload("Text1.txt", Encoding.ASCII.GetBytes("hello1"));

ftpClient.TransfersDataType = FtpDataType.Binary;
ftpClient.Upload("Text2.txt", Encoding.ASCII.GetBytes("hello2"));

Resulting output:

C: CLNT Ftp.dll
S: 200 Don't care
C: OPTS UTF8 ON
S: 202 UTF8 mode is always enabled. No need to send this command.
C: TYPE A
S: 200 Type set to A
C: PASV
S: 227 Entering Passive Mode (127,0,0,1,192,158)
C: STOR Text1.txt
S: 150 Opening data channel for file upload to server of "/Text1.txt"
Data connection established.
S: 226 Successfully transferred "/Text1.txt"
C: TYPE I
S: 200 Type set to I
C: PASV
S: 227 Entering Passive Mode (127,0,0,1,194,55)
C: STOR Text2.txt
S: 150 Opening data channel for file upload to server of "/Text2.txt"
Data connection established.
S: 226 Successfully transferred "/Text2.txt"
by (301k points)
...