title: Upload image to a FTP Server using PCL Xamarin Forms
body: <p>i'm new on Xamarin and C# world and i'm trying to upload an Image to a FTP Server. I saw the FtpWebRequest class to do this but i'm not getting it right, i don't know how to inject plataform specific code and i don't even know what it really mean, already watched this video (<a href="https://www.youtube.com/watch?feature=player_embedded&amp;v=yduxdUCKU1c" rel="nofollow noreferrer">https://www.youtube.com/watch?feature=player_embedded&amp;v=yduxdUCKU1c</a>) but i don't see how to use this to create the FtpWebRequest class and upload the image.</p>
  
  <p>I Saw this code(here: <a href="https://forums.xamarin.com/discussion/9052/strange-behaviour-with-ftp-upload" rel="nofollow noreferrer">https://forums.xamarin.com/discussion/9052/strange-behaviour-with-ftp-upload</a>) to send a picture and i'm unable to use it.</p>
  
  <pre><code>public void sendAPicture(string picture)
  {
  
      string ftpHost = "xxxx";
  
      string ftpUser = "yyyy";
  
      string ftpPassword = "zzzzz";
  
      string ftpfullpath = "ftp://myserver.com/testme123.jpg";
  
      FtpWebRequest ftp = (FtpWebRequest)FtpWebRequest.Create(ftpfullpath);
  
      //userid and password for the ftp server  
  
      ftp.Credentials = new NetworkCredential(ftpUser, ftpPassword);
  
      ftp.KeepAlive = true;
      ftp.UseBinary = true;
      ftp.Method = WebRequestMethods.Ftp.UploadFile;
  
      FileStream fs = File.OpenRead(picture);
  
      byte[] buffer = new byte[fs.Length];
      fs.Read(buffer, 0, buffer.Length);
  
      fs.Close();
  
      Stream ftpstream = ftp.GetRequestStream();
      ftpstream.Write(buffer, 0, buffer.Length);
      ftpstream.Close();
      ftpstream.Flush();
  
      //  fs.Flush();
  
  }
  </code></pre>
  
  <p>I don't have a type FileStream, WebRequestMethods and File, also my FtpWebRequest class doens't have "KeepAlive", "UseBinary" and "GetRequestStream" methods, and my Stream class doesn't have "Close" method.</p>
  
  <p>My FtpWebRequest Class:</p>
  
  <p>public sealed class FtpWebRequest : WebRequest
  {
      public override string ContentType
      {
          get
          {
              throw new NotImplementedException();
          }</p>
  
  <pre><code>    set
      {
          throw new NotImplementedException();
      }
  }
  
  public override WebHeaderCollection Headers
  {
      get
      {
          throw new NotImplementedException();
      }
  
      set
      {
          throw new NotImplementedException();
      }
  }
  
  public override string Method
  {
      get
      {
          throw new NotImplementedException();
      }
  
      set
      {
          throw new NotImplementedException();
      }
  }
  
  public override Uri RequestUri
  {
      get
      {
          throw new NotImplementedException();
      }
  }
  
  public override void Abort()
  {
      throw new NotImplementedException();
  }
  
  public override IAsyncResult BeginGetRequestStream(AsyncCallback callback, object state)
  {
      throw new NotImplementedException();
  }
  
  public override IAsyncResult BeginGetResponse(AsyncCallback callback, object state)
  {
      throw new NotImplementedException();
  }
  
  public override Stream EndGetRequestStream(IAsyncResult asyncResult)
  {
      throw new NotImplementedException();
  }
  
  public override WebResponse EndGetResponse(IAsyncResult asyncResult)
  {
      throw new NotImplementedException();
  }
  </code></pre>
  
  <p>}</p>
  
  <p>(I know, i didn't wrote anything there, just pressed ctrl + . because i don't know what to write there)</p>
  
  <p>Does anyone can provide me a full sample of a FtpWebRequest class? i only find the class in use like this one above.</p>