D
D
dmitriy2018-03-23 08:31:02
PHP
dmitriy, 2018-03-23 08:31:02

After uploading photos to the photo album, the same photo is added, how to fix it?

When you try to add new_photo.jpg or something else in the photo album in classmates, an old photo appears that was uploaded a few days ago, let's call it last_photo.jpg , the photosV2.commit
method returns in response an array of photos with properties status=SUCCESS, with different photo_id , assigned_photo_id which is normal, but aid is always the same.
What do you need to add new photos?

$image_path = "......./upload/new_photo.jpg";
            $cfiles ["file"]= curl_file_create($image_path,mime_content_type($image_path),'new_photo.jpg');

            $ch = curl_init($uploadUrl);//получен через  photosV2.getUploadUrl
            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $cfiles);
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);    
            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);  
            $result = json_decode(curl_exec($ch), true);
            curl_close($ch); 

            foreach($result["photos"] as $photo_id => $data){
                 $_result = $Client->call('photosV2.commit',[
                     "token"     =>  $data["token"],
                     "photo_id"  =>  $photo_id,
                     "comment"   =>  "test....."
                 ]);     
            }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2018-03-23
@dimonchik2013

rename last_photo.jpg to outside_photo.jpg

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question