Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- FtpWebRequest ftpClient = (FtpWebRequest)FtpWebRequest.Create(FTPdestination+ i + ".txt");
- ftpClient.Credentials = new System.Net.NetworkCredential(user, pass);
- ftpClient.Method = System.Net.WebRequestMethods.Ftp.UploadFile;
- ftpClient.UseBinary = true;
- ftpClient.EnableSsl = true;
- ftpClient.KeepAlive = true;
- System.IO.FileInfo fi = new System.IO.FileInfo(server+dtm+"_"+i+".txt");
- ftpClient.ContentLength = fi.Length;
- byte[] buffer = new byte[4097];
- int bytes = 0;
- int total_bytes = (int)fi.Length;
- System.IO.FileStream fs = fi.OpenRead();
- System.IO.Stream rs = ftpClient.GetRequestStream();
- while (total_bytes > 0)
- {
- bytes = fs.Read(buffer, 0, buffer.Length);
- rs.Write(buffer, 0, bytes);
- total_bytes = total_bytes - bytes;
- }
- fs.Close();
- rs.Close();
- FtpWebResponse uploadResponse = (FtpWebResponse)ftpClient.GetResponse();
- uploadResponse.Close();
Add Comment
Please, Sign In to add comment