title: Sending file to API with http client
body: <p>I'm working on sending a file to an api endpoint that is giving me the following curl example to post.</p>
  <pre><code>curl -X POST -H &quot;Authorization: ACCESS_TOKEN&quot; -H &quot;Content-Type: multipart/form-data&quot; -F &quot;file=@submission.zip&quot; api_url
  </code></pre>
  <p>This is the code I'm using - prior to this I'm getting a successful authentication response but a 500 response from this.</p>
  <pre><code>$file = fopen('C:\\Users\\username\\Desktop\\api\\' . $fileName, 'r');
  
          return $this-&gt;client-&gt;request(
              'POST',
              'api_url', [
                  'headers'=&gt;[
                      'Authorization'=&gt;$accessToken,
                      'Content-Type'=&gt; 'multipart/form-data'
                  ],
                  'body'=&gt;[
                      'file'=&gt; $file
                  ]
              ]
          );
  </code></pre>
  <p>I'm not sure what else I'm missing here. Any suggestions are appreciated.</p>