title: How to properly uploads files to certain api uisng curl in php
body: <p>Am trying to add/upload files to monday.com api via curl in php but the code throws error <code>{&quot;error_message&quot;:&quot;Internal server error&quot;,&quot;status_code&quot;:500}</code></p>
  <p><a href="https://api.developer.monday.com/docs/files-queries" rel="nofollow noreferrer">Monday Docs</a></p>
  <p><strong>here is the API Curl request</strong></p>
  <pre><code>curl --location --request POST 'https://api.monday.com/v2/file' \
  --header 'Authorization: YourSuperSecretAPIKey' \
  --form 'query=&quot;mutation add_file($file: File!, $item_id: Int!, $column_id: String!) {add_file_to_column (item_id: $item_id, column_id: $column_id, file: $file) {id}}&quot;' \
  --form 'variables=&quot;{\&quot;item_id\&quot;:1104589438, \&quot;column_id\&quot;: \&quot;files\&quot;}&quot;' \
  --form 'map=&quot;{\&quot;image\&quot;:\&quot;variables.file\&quot;}&quot;' \
  --form 'image=@&quot;/Users/alexsavchuk/Downloads/300px-All_Right_Then,_Keep_Your_Secrets.jpg&quot;'
  </code></pre>
  <p><strong>Arguments Description of the API Variable</strong></p>
  <pre><code>item_id !Int    The item ID where the file will be added.
  column_id !String   The column where the file will be added.
  file !File  The file to upload.
  </code></pre>
  <p><strong>Here is my coding efforts</strong></p>
  <pre><code>$token = 'Token goes here';
  $curl = curl_init();
  curl_setopt_array($curl, array(
    CURLOPT_URL =&gt; 'https://api.monday.com/v2/file',
    CURLOPT_RETURNTRANSFER =&gt; true,
    CURLOPT_ENCODING =&gt; '',
    CURLOPT_MAXREDIRS =&gt; 10,
    CURLOPT_TIMEOUT =&gt; 0,
    CURLOPT_FOLLOWLOCATION =&gt; true,
    CURLOPT_HTTP_VERSION =&gt; CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST =&gt; 'POST',
    CURLOPT_POSTFIELDS =&gt; array('query' =&gt; 'mutation ($file: File!) { add_file_to_column(file: $file, item_id: 279111, column_id: &quot;files&quot;) { id } }','variables[file]'=&gt; new CURLFILE('https://cdn.pixabay.com/photo/2015/05/26/12/30/baby-784608_960_720.jpg')),
    CURLOPT_HTTPHEADER =&gt; array('Authorization: ' . $token)));
  $response = curl_exec($curl);
  curl_close($curl);
  echo $response;
  </code></pre>