0 votes

How to send image in byte to ftp, it is very slow

by (350 points)

1 Answer

0 votes

Ftp.dll is definitely not slow. It is well optimized and works very fast.

The problem may be with your internet connect speed, or the FTP server (are you using shared hosting?).

Upload transfers on localhost are as follows:
Without SSL: ~50 MB/second (400 Mb/s)
With SSL: ~18 MB/second
Are you using SSL? Does your server support compression?

As for the question, I assume you are asking how to send a file stored as byte array in memory. It's easy Ftp.Upload method has an overload that takes byte array as parameter:

using (Ftp client = new Ftp())
{
    client.Connect("ftp.example.com");    // or ConnectSSL for SSL
    client.Login("user", "password");

    byte[] bytes = Encoding.UTF8.GetBytes("Hello from Ftp.dll");
    client.Upload("report.txt", bytes);

    client.Close();
}

There are also other Ftp.Upload overloads that take file name or MemoryStream as parameters.

by (297k points)
edited by
...