title: How to rename a file after upload
body: <p>I have to upload file using Ftp protocol on server, and rename uploaded file after uploading.</p>
  
  <p>I can upload it, but don't know how to rename it.</p>
  
  <p>Code looks like this:</p>
  
  <pre><code>FtpWebRequest requestFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + ftpServer + "/" + "httpdocs/webroot/" + destination + "/" + fileName));
  requestFTP.Proxy = null;
  
  requestFTP.Credentials = new NetworkCredential(ftpUser, ftpPassword);
  requestFTP.Method = WebRequestMethods.Ftp.UploadFile;
  FileStream fStream = fileInfo.OpenRead();
  int bufferLength = 2048;
  byte[] buffer = new byte[bufferLength];
  Stream uploadStream = requestFTP.GetRequestStream();
  int contentLength = fStream.Read(buffer, 0, bufferLength);
  while (contentLength != 0)
  {
    uploadStream.Write(buffer, 0, contentLength);
    contentLength = fStream.Read(buffer, 0, bufferLength);
  }
  uploadStream.Close();
  fStream.Close();
  
  requestFTP = null;
  
  string newFilename = fileName.Replace(".ftp", "");
  requestFTP.Method = WebRequestMethods.Ftp.Rename; // this like makes a problem
  requestFTP.RenameTo(newFilename);
  </code></pre>
  
  <p>Error I'm getting is </p>
  
  <blockquote>
    <p>Error 2   Non-invocable member 'System.Net.FtpWebRequest.RenameTo'
    cannot be used like a method.</p>
  </blockquote>