Я нашел несколько вопросов, связанных с этим, но я не получил никакого подходящего ответа. Вот мой код:curl_setopt() бросает ошибку при попытке загрузить файл curl в php
$requestUrl = <MY_URL>;
$filePath = <MY_FILE_PATH>;
$post = array('extra_info' => '123456','file_contents'=>'@'.$filePath);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$requestUrl);
curl_setopt($ch, CURLOPT_POST,1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
Я получаю исключение об ошибке, как:
curl_setopt(): The usage of the @filename API for file uploading is deprecated. Please use the CURLFile class instead.
Любая помощь будет оценен по достоинству!
какую версию PHP вы используете? – Naincy
Я использую версию php 5.5.9 –
Пожалуйста, проверьте решение здесь: http://stackoverflow.com/questions/20972513/php-curl-the-usage-of-the-filename-api-for-file- загрузка-это-осуждается – versha