S
S
Sergey2016-05-11 10:41:16
In contact with
Sergey, 2016-05-11 10:41:16

How to send an image to the Vkontakte server in Flash?

Who worked in AS3 with photos.getUploadServer the situation is such that the address for uploading comes, using URLLoader I send URLVariables there with the name file1 where inside ByteArray, which is obtained from JPGEncoder from bitmapdata.
The header is req.requestHeaders.push(new URLRequestHeader('Content-type', 'image/jpeg'));
But the response is an empty photos_list array, which I don’t understand where to dig. I tried to change the header to multipart, it's useless. I also checked the ByteArray data, loader loadbytes takes the picture perfectly.

var loader1:URLLoader = new URLLoader(); 
var varb:URLVariables = new URLVariables(); 

var jpgEncoder:JPGEncoder = new JPGEncoder(90); 

var file1:ByteArray = jpgEncoder.encode( prevbitmap.bitmapData ); 
varb.file1 = file1; 

var req:URLRequest = new URLRequest(data.upload_url); 
req.method = URLRequestMethod.POST; 
req.requestHeaders.push(new URLRequestHeader('Content-type', 'image/jpeg')); 
req.data = varb; 

loader1.load(req);

Who faced a similar problem?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question