Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Console.WriteLine("Uploading");
- FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://domain.tld/file.json");
- request.Method = WebRequestMethods.Ftp.UploadFile;
- request.Credentials = new NetworkCredential("username", "password");
- StreamReader sourceStream = new StreamReader("file.json");
- byte[] fileContents = Encoding.UTF8.GetBytes(sourceStream.ReadToEnd());
- sourceStream.Close();
- request.ContentLength = fileContents.Length;
- Stream requestStream = request.GetRequestStream(); //It gets stuck on this line
- requestStream.Write(fileContents, 0, fileContents.Length);
- requestStream.Close();
- Console.WriteLine("Uploaded");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement