I am trying to transfer the file to the server using CURL
The request is formed as follows:
$postdata = array( 'FileToLoad' => "@".$this->file."; filename=\"$this->filename\";", 'fileId' => $this->fileId); $this->file contains the full path to the file on the server /var/www/site/data/www/site.ru/tmp/file.pdf
I send it like this:
if( $curl = curl_init() ) { curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER,true); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata); curl_setopt($curl,CURLOPT_ENCODING, ''); curl_setopt($curl, CURLOPT_COOKIE, ".ASPXAUTH=$this->token;"); $out = curl_exec($curl); curl_close($curl); } The request is successful, but the data gets into $ _POST, and I really want to see them in $ _FILES. Where am I wrong?