title: Upload file on FTP
body: <p>I want to upload file from one server to another FTP server and following is my code to upload file but it is throwing an error as: </p>
  
  <blockquote>
    <p>The remote server returned an error: (550) File unavailable (e.g., file not found, no access).</p>
  </blockquote>
  
  <p>This my code:</p>
  
  <pre><code>string CompleteDPath = "ftp URL";
  string UName = "UserName";
  string PWD = "Password";
  WebRequest reqObj = WebRequest.Create(CompleteDPath + FileName);
  reqObj.Method = WebRequestMethods.Ftp.UploadFile;
  reqObj.Credentials = new NetworkCredential(UName, PWD);
  FileStream streamObj = System.IO.File.OpenRead(Server.MapPath(FileName));
  byte[] buffer = new byte[streamObj.Length + 1];
  streamObj.Read(buffer, 0, buffer.Length);
  streamObj.Close();
  streamObj = null;
  reqObj.GetRequestStream().Write(buffer, 0, buffer.Length);
  reqObj = null; 
  </code></pre>
  
  <p>Can you please tell me where i am going wrong?</p>