title: The usage of the @filename API for file uploading is deprecated. Please use the CURLFile class instead
body: <p>I am beginner to php and i was exercising by HP's IDOL OnDemand api to extract texts from any image file.</p>
  
  <p>I had to set a curl connection and execute api request but when i try to post file by using @ method, in php 5.5 its deprecated and recommends me to use CURLFile.</p>
  
  <p>I also digged php manuals and came up with something like this <a href="https://wiki.php.net/rfc/curl-file-upload" rel="nofollow">https://wiki.php.net/rfc/curl-file-upload</a></p>
  
  <p>Code is as below:</p>
  
  <pre><code>$url = 'https://api.idolondemand.com/1/api/sync/ocrdocument/v1';
  
  $output_dir = 'uploads/';
  if(isset($_FILES["file"])){
  
  $filename = md5(date('Y-m-d H:i:s:u')).$_FILES["file"]["name"];
  
  move_uploaded_file($_FILES["file"]["tmp_name"],$output_dir.$filename);
  
  $filePath = realpath($output_dir.$filename);
  $post = array(
      'apikey' =&gt; 'apikey-goes-here',
      'mode' =&gt; 'document_photo',
      'file' =&gt; '@'.$filePath
  );
  
  $ch = curl_init();
  curl_setopt($ch, CURLOPT_URL,$url);
  curl_setopt($ch, CURLOPT_POST,1);
  curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
  $result = curl_exec($ch);
  curl_close($ch);
  echo $result;
  
  unlink($filePath);
  </code></pre>
  
  <p>If any rewrite code and show me how to use Curlfile i would be appreciate.</p>
  
  <p>Thanks,</p>