//First create FtpWebRequest object with the ftpURL

System.Net.FtpWebRequest ftpRequest = (System.Net.FtpWebRequest)System.Net.WebRequest.Create(CompleteFTPPath);

//Set the ftp Method, like 'UploadFile' for upload

ftpRequest.Method = System.Net.WebRequestMethods.Ftp.UploadFile;

//Give your user name & password of the ftp login

ftpRequest.Credentials = new System.Net.NetworkCredential("username", "password");

ftpRequest.UsePassive = false;

//read your local file with stream and save it in a buffer

System.IO.FileStream streamObj = System.IO.File.OpenRead(CompleteLocalPath);

byte[] buffer = new byte[Convert.ToInt32(streamObj.Length)];


streamObj.Read(buffer, 0, buffer.Length);

streamObj.Close();


streamObj = null;

//read your buffer and save it to the FTP Server

ftpRequest.GetRequestStream().Write(buffer, 0, buffer.Length);

ftpRequest = null;