title: How to send file data as post parameter in BuzzBrowser post call
body: <p>I am using <a href="https://github.com/kriswallsmith/Buzz/blob/master/lib/Buzz/Browser.php" rel="nofollow">Buzz Browser</a> for calling <code>POST</code> method. I am receiving a file from client at one of the <code>end point</code>.</p>
  
  <pre><code>$fileObj = $requestObject-&gt;files-&gt;get('image_data');
  </code></pre>
  
  <p>This is correct <code>fileObject</code>. I have verified this using <code>is_file()</code> method.</p>
  
  <p>Now, I have to fire a <code>Buzz Browser</code> post event using this file as parameter.</p>
  
  <pre><code>$headers = array('Content-Type'=&gt;'multipart/form-data'); 
  $url = $genericHost . $api; //A valid URL
  $params = array('image_data' =&gt; $fileObj);//fileObj obtained above
  </code></pre>
  
  <p>Posting this info using <code>buzzBrowser</code></p>
  
  <pre><code>$browser-&gt;post($url, $headers, $params);
  </code></pre>
  
  <p>And receiving it as-</p>
  
  <pre><code>$fileObj = $this-&gt;get('request')-&gt;files-&gt;get('image_data');
  </code></pre>
  
  <p>But, the final <code>$fileObj</code> is <code>NULL</code>.</p>
  
  <p>I tried to dump the <code>$this-&gt;get('request')-&gt;files</code>-</p>
  
  <pre><code>object(Symfony\Component\HttpFoundation\FileBag)#11 (1) {
  ["parameters":protected]=&gt;
       array(0) {
      }
  }
  </code></pre>
  
  <p>Means no file is there. What is wrong in my approach?</p>
  
  <p><strong>Edit:1</strong></p>
  
  <p>After debugging more, I found that file object is being sent as normal parameters:</p>
  
  <pre><code>["request"]=&gt;
    object(Symfony\Component\HttpFoundation\ParameterBag)#7 (1) {
      ["parameters":protected]=&gt;
      array(1) {
        ["image_data"]=&gt;
        string(14) "/tmp/php6QLezs"
      }
    }
  </code></pre>
  
  <p>The header of the request is:</p>
  
  <pre><code>["headers"]=&gt;
     object(Symfony\Component\HttpFoundation\HeaderBag)#13 (2) {
      ["headers":protected]=&gt;
      array(7) {
        ["content-type"]=&gt;
        array(1) {
          [0]=&gt;
          string(70) "multipart/form-data; boundary=----------------------------1b3e33ff2ecb"
        }
        ["content-length"]=&gt;
        array(1) {
          [0]=&gt;
          string(3) "159"
         }
        ["host"]=&gt;
        array(1) {
          [0]=&gt;
          string(16) "host_name"
        }
        ["accept"]=&gt;
          array(1) {
         [0]=&gt;
         string(3) "*/*"
       }
       ["x-php-ob-level"]=&gt;
        array(1) {
         [0]=&gt;
         int(1)
       }
      }
  </code></pre>