I am trying to upload a photo to VK through their api. Here is my code:
let image = UIImage(named: "vk")! let data = image.pngData()! let site = URL(string: "https://pu.vk.com/c****/upload.php?*****....")! //<= Ссылка для загрузки фотографий в альбом upload(multipartFormData: { (multipartFormData) in multipartFormData.append(data, withName: "imagefile", fileName: "image.jpg", mimeType: "image/jpeg") }, to: site) { (encodingResult) in switch encodingResult { case .success(let uploadRequest, let streamingFromDisk, let streamFileURL): print("success") print(uploadRequest) uploadRequest.validate().responseJSON() { responseJSON in switch responseJSON.result { case .success(let value): print(value) case .failure(let error): print(error) } } case .failure(let error): print(error) } } The console displays the answer:
{ aid = ******; hash = ******; "photos_list" = "[]"; server = *****; } The photo_list is empty, although it should contain information, for later saving the image of the image in the VK album. Tell me what am I doing wrong?