File Uploading from client to FTP.
private void UploadFileToFtp(string ftpServer, string ftpUser, string ftpPass, string filename,List<string> files, out string strMsg)
{
strMsg = string.Empty;
foreach (string file in files)
{
System.IO.FileInfo fileInf = new System.IO.FileInfo(file);
FtpWebRequest reqFTP;
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(string.Format("{0}/{1}", ftpServer, fileInf.Name)));
reqFTP.Credentials = new NetworkCredential(ftpUser, ftpPass);
reqFTP.KeepAlive = false;
reqFTP.Method = WebRequestMethods.Ftp.UploadFile;
reqFTP.UseBinary = true;
reqFTP.ContentLength = fileInf.Length;
int buffLength = 20480;
Join the conversation! Your thoughts help the community grow.