Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
–1 vote
in .NET FTP by (160 points)
recategorized by

Using edtFtpPro.net...

Using a SecureFTPConnection with ftp.TransferType = FTPTransferType.BINARY; and ftp.DetectTransferMode = false; on the constructor.

on some other method, when uploading a file:

 using (var stream = File.Open(realSource, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.None))


                    currentFileSize = stream.Length;

                    ftp.UploadStream(stream, realFn);


then the transfer keeps selecting ASCII for some files  (I guess, based on the extension of realFn), resulting in corrupted files sometimes.

How do I do to prevent this to happen and use ONLY binary transfers with streams?
by (51.4k points)
Are you using FTPS or SFTP?
by (160 points)
Same thing for both. I need to add ftp.TransferType = FTPTransferType.BINARY before EVERY file. Then it works fine.
by (51.4k points)
If you have a current support agreement then please open a ticket at https://enterprisedt.com/help. If you don't then please enable logging and look at the commands sent and the responses received. I'll be difficult to post much of the log here, but if you can then please post the relevant section.

Please log in or register to answer this question.