Answer the question
In order to leave comments, you need to log in
Why is the photo not uploaded to the Vkontakte server?
There is an address for uploading a photo, and a file to upload. The code is the following:
$post_params['file'.$i] = 'myscreenshot.png';
$ch = curl_init($upl_server);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, false );
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false );
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_params);
$response = curl_exec( $ch );
curl_close( $ch );
echo($response);
Answer the question
In order to leave comments, you need to log in
Before the filename you lost the dog. That is, you should have something like this:
For greater clarity, a piece of my code:
$ch = curl_init();
$parameters = array(
"file1" => '@'.__DIR__.'/path/to/myscreenshot.png'
);
curl_setopt($ch, CURLOPT_URL, $upl_server);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $parameters);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
$curl_result = curl_exec($ch);
curl_close($ch);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question