S
S
Shenku2017-02-10 00:13:29
In contact with
Shenku, 2017-02-10 00:13:29

Why does not upload photos to Vkontakte?

After moving to another server, photos stopped uploading to VK

$photo = array(
          'file1' => "@".$_SERVER['DOCUMENT_ROOT'].CFile::GetPath($arFields['PREVIEW_PICTURE_ID'])
        );

        $ch = curl_init();

        curl_setopt($ch, CURLOPT_URL, $upload_url_vk);
        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, $photo);

        $otvet = json_decode(curl_exec($ch));
        curl_close($ch);

the photo looks like "@/home/c/caravansum/public_html/upload/iblock/450/450bb5d2b7cc44169759397be9879cdd.png"
the path gives
the following error
[error_code] => 100
[error_msg] => One of the parameters specified was missing or invalid: photos_list is invalid
Previously, everything worked without problems, as the server changed everything, and the post is added, except for the photo
. Thanks in advance.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
SagePtr, 2017-02-10
@Sh3nku

Because @ to specify a file is deprecated.
Need to use this: php.net/manual/en/class.curlfile.php
Or set CURLOPT_SAFE_UPLOAD to false

A
Anton, 2017-02-14
@Eridani

Today I just tried to download from beget.ru, nothing worked, but from the local - just go.

C
Cotto, 2017-05-06
@Cotto

A similar question, please tell me how to solve
the site loress.ru I
installed an SSL certificate, I didn’t use export to VK for a long time, I decided to export to a group, but an error occurred in the form:
An error occurred when exporting a product 3D sticker on the rear window of a car:
vkApiException: One of the parameters specified was missing or invalid: photos_list is invalid [code 100]
Deleted the module, installed another version, also deleted it again, returned the old one and still an error. Previously, when I clicked "Add a photo to the group" an error came out, now when I go in - this error is immediately visible I made a
log, it turned out like this:
Date: 05/06/17 21:42:42
Url: https://api.vk.com /method/photos.getUploadServer
Post: album_id = 235729481 & group_id = 117403869 && v = 5.3 & the access_token = 2edd111225aa04d1d4727da2dae7e74cc2c82b3b0eb557a5d8627d6501fcd4c37e2f281d18ffe3f6f58ec
{ "response": { "upload_url": "https: \ / \ / pu.vk.com \ / c639131 \ /upload.php ACT = do_add & the mid = 355736919 & aid = 235729481 & gid? = 117403869 & hash = 008bfa4ee4fac00863879f5a2626d9e9 & rhash = a26ff8c0b3cde6dab939d6c1c75d7dac & swfupload =1 & api = 1 "," album_id ": 235729481," user_id ": 355736919}}
stdClass Object
(
[response] => stdClass Object
(
[upload_url] => https://pu.vk.com /c639131/upload.php?act=do_add&mi...
[album_id] => 235729481
[user_id] =>355736919
)
)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question