title: Xamarin.Forms upload image to server directory
body: <p>I have to upload an image from my application to a php web service i tried this code:</p>
  
  <pre><code>private void  upload(MediaFile mediaFile)
  {
      try
      {   
          byte[] data = ReadFully(mediaFile.Source);
  
          var imageStream = new ByteArrayContent(data);
          imageStream.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment")
          {
              FileName = Guid.NewGuid() + ".Png"
          };
  
          var multi = new MultipartContent();
          multi.Add(imageStream);
          var client = new System.Net.Http.HttpClient();
          client.BaseAddress = new Uri("url");
          var result = client.PostAsync("api/ManageImage", multi).Result;
      }
      catch (Exception e)
      {
  
      }
  
  }
  </code></pre>
  
  <p>PHP:</p>
  
  <pre><code>&lt;?php
  
      $uploads_dir = 'Image/'; //Directory to save the file that comes from 
      client application.      
      if ($_FILES["file"]["error"] == UPLOAD_ERR_OK)       
      {      
          $tmp_name = $_FILES["file"]["tmp_name"];     
          $name = $_FILES["file"]["name"];    
          move_uploaded_file($tmp_name, "$uploads_dir/$name");   
      }
  ?&gt;
  </code></pre>
  
  <p>i take the file with Xam.Plugin.FilePicker but i don't know how to send and how to recive the image</p>