title: Post a not empty file to Dspace with Curl
body: <p>I am posting a file to dspace through dspace api, I am doing this with an action in php. With postman I send a form-data with the file, filename, bitstream id and token.</p>
  <p><a href="https://i.stack.imgur.com/jRsNH.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jRsNH.jpg" alt="enter image description here" /></a></p>
  <p>I am getting the temp file path with $_FILES and sending it by postfields curl option, but the file uploads empty, or with weird data, without its content.</p>
  <pre><code>public function actionSubirBitstream()
      {
          if (Yii::$app-&gt;request-&gt;isPost) {
              $body = $_POST;
  
              $prefijo = '/rest/items/';
              $host = ConfiguracionDspace::find()-&gt;where(&quot;clave='host'&quot;)-&gt;one()-&gt;valor;
              $puerto = ConfiguracionDspace::find()-&gt;where(&quot;clave='puerto'&quot;)-&gt;one()-&gt;valor;
  
              $token = $body['token'];
              $id = $body['id'];
              $final = '/bitstreams';
  
              $name = $body['name'];//nombre del archivo sin espacios
              $params = &quot;?name=$name&quot;;
              $url = $host . ':' . $puerto . $prefijo . $id . $final . $params;
  
              $file = $_FILES['file']['tmp_name'];
              //$path = $body['path'];
              //$file = new CURLFILE(&quot;$path&quot;);
  
              $headers = array(&quot;Content-Type: application/json&quot;, 'Accept: application/json', &quot;rest-dspace-token: &quot; . $token);
  
              $curl = curl_init($url);
              $options = array(
                  CURLOPT_CUSTOMREQUEST =&gt; &quot;POST&quot;,
                  CURLOPT_POSTFIELDS =&gt; array('file'=&gt; $file,'name' =&gt; $name),
                  CURLOPT_RETURNTRANSFER =&gt; true,
                  CURLOPT_HTTPHEADER =&gt; $headers
              );
  
              curl_setopt_array($curl, $options);
              $response = curl_exec($curl);
              curl_close($curl);
              return $response;
          }
      }
  </code></pre>
  <p><a href="https://i.stack.imgur.com/lM8Yh.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lM8Yh.jpg" alt="enter image description here" /></a></p>