FileInfo f=new FileInfo("C:\\mdu\\abcd.xml"); string uploadfile=f.FullName; Console.WriteLine(f.Name); Console.WriteLine("uploadfile"+uploadfile); var client = new SftpClient(host, port, username, password); client.Connect(); if(client.IsConnected){ Console.WriteLine("I AM CONNECTED"); } var fileStream = new FileStream(uploadfile, FileMode.Open); if(fileStream!=null){ Console.WriteLine("YOU ARE NOT NULL"); } client.BufferSize = 4 * 1024; client.UploadFile(fileStream, f.Name,null); client.Disconnect(); client.Dispose();