title: Upload a file to an FTP server from a string or stream
body: <p>I'm trying to create a file on an FTP server, but all I have is either a string or a stream of the data and the filename it should be created with. Is there a way to create the file on the server (I don't have permission to create local files) from a stream or string?</p>
  
  <pre><code>string location = "ftp://xxx.xxx.xxx.xxx:21/TestLocation/Test.csv";
  
  WebRequest ftpRequest = WebRequest.Create(location);
  ftpRequest.Method = WebRequestMethods.Ftp.UploadFile;
  ftpRequest.Credentials = new NetworkCredential(userName, password);
  
  string data = csv.getData();
  MemoryStream stream = csv.getStream();
  
  //Magic
  
  using (var response = (FtpWebResponse)ftpRequest.GetResponse()) { }
  </code></pre>