boutique replica bags up ideas

the best replique rolex and prices here.

julia highlight 99j hair color 10a quality straight human hair lace front wigs 8 - 24 inches pre plucked hairline 13x4 inches lace front brazilian wig onlinefor sale

Upload files using the FTP in C#

Updated on     Kisan Patel

To upload files using the File Transfer Protocol (FTP), you need to use the System.Net.FtpWebRequest class.

string uploadFilePath = @"C:\example.html";
string targetFileName = "example.pdf";
Uri ftpSite = new Uri("ftp://example.com/" + targetFileName);
FileInfo fileInfo = new FileInfo(uploadFilePath);
FtpWebRequest request = (FtpWebRequest)WebRequest.Create(ftpSite);
request.Method = WebRequestMethods.Ftp.UploadFile;
request.UseBinary = true;
request.ContentLength = fileInfo.Length;
request.Credentials = new NetworkCredential("username", "password");
byte[] byteBuffer = new byte[4096];
using (Stream requestStream = request.GetRequestStream())
{
    using (FileStream fileStream = new FileStream(uploadFilePath, FileMode.Open))
    {
        int bytesRead = 0;
        do
        {
            bytesRead = fileStream.Read(byteBuffer, 0, byteBuffer.Length);
            if (bytesRead > 0)
            {
                requestStream.Write(byteBuffer, 0, bytesRead);
            }
        }
        while (bytesRead > 0);
    }
}
using (FtpWebResponse response = (FtpWebResponse)request.GetResponse())
{
    Console.WriteLine(response.StatusDescription);
}

C#

Leave a Reply