private void Upload(string filename) { string ftpHost = ftpServerIP; //here correct hostname or IP of the ftp server to be given FileInfo fileInf = new FileInfo(filename); string ftpFullPath = "ftp://" + ftpHost + fileInf.Name; MessageBox.Show(ftpFullPath); FtpWebRequest ftp = (FtpWebRequest)FtpWebRequest.Create(ftpFullPath); ftp.Credentials = new NetworkCredential(ftpUserID, ftpPassword); //userid and password for the ftp server to given ftp.KeepAlive = true; ftp.UseBinary = true; ftp.Method = WebRequestMethods.Ftp.UploadFile; FileStream fs = File.OpenRead(filename); byte[] buffer = new byte[fs.Length]; fs.Read(buffer, 0, buffer.Length); fs.Close(); Stream ftpStream = ftp.GetRequestStream(); ftpStream.Write(buffer, 0, buffer.Length); }
myFtpRequestObj.Proxy = new WebProxy();
request.Proxy = nothing
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)