Answer the question
In order to leave comments, you need to log in
How to upload images of VKontakte products?
I do everything according to the instructions
1) I get the address for uploading via the "photos.getMarketUploadServer" method
2) I send a POST request to the received upload_url, where I pass the image in the "file" parameter
3) In response I get "ERR_UPLOAD_BAD_IMAGE_SIZE: owner photo min size 200x200 your size 0x0 4", but the image is definitely larger than 200x200.
To eliminate the error, I made an html form and sent the file through it, the result is similar:
PHP code:
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => 1,
CURLOPT_POSTFIELDS => ['file' => '@/var/www/site/images/image.jpg'],
CURLOPT_URL => $url,
]);
$result = curl_exec($ch);
curl_close($ch);
Answer the question
In order to leave comments, you need to log in
The API gives incorrect information about the allowed width and height of the image. It must be at least 400 pixels wide and high. This warning is displayed if you add a product image through the web interface.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question