title: Sending file to Anonfile using Curl and PHP
body: <p>I'm trying to send a file using curl and PHP on <a href="https://anonfile.com/docs/api" rel="nofollow noreferrer">anonfile</a> but 
  I get this json:</p>
  
  <blockquote>
    <p>{"status":false,"error":{"message":"No file
    chosen.","type":"ERROR_FILE_NOT_PROVIDED","code":10}}</p>
  </blockquote>
  
  <pre><code>$ch = curl_init();
  
  curl_setopt($ch, CURLOPT_URL,"https://anonfile.com/api/upload");
  curl_setopt($ch, CURLOPT_POST, 1);
  curl_setopt($ch, CURLOPT_POSTFIELDS,'test.txt');
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  
  $server_output = curl_exec($ch);
  print_r($server_output);
  curl_close ($ch);
  </code></pre>
  
  <p>In other words, how to translate this command into PHP?</p>
  
  <pre><code>curl -F "file=@test.txt" https://anonfile.com/api/upload
  </code></pre>
  
  <p>I tried several examples out there but still no clue</p>
  
  <pre><code>$target_url = 'https://anonfile.com/api/upload';
  $args['file'] = '@/test.txt';
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL,$target_url);
  curl_setopt($ch, CURLOPT_POST,1);
  curl_setopt($ch, CURLOPT_POSTFIELDS, $args);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  $result=curl_exec ($ch);
  curl_close ($ch);
  echo $result;
  </code></pre>