Answer the question
In order to leave comments, you need to log in
How to publish a post with an attachment on behalf of a user?
I am writing an iframe application for VKontakte and, to be honest, I have already become stupid. The essence of the application is such that a form is filled in, which, after pressing send, collects all the fields, arranges them as needed and generates the necessary text. Everything else still needs the ability to attach images.
I wrote the mechanism itself, and apparently, like the admin, the pictures were loaded and everything worked. Until now, this has been the case. For other users, an error with rights fell out when receiving a server link to download an image. But just recently, when I tried to get the server address, I also wrote "Access denied: no access to call this method". But the most interesting thing is that in the form from the documentation with the same data, both for me and for another user, the images are loaded perfectly and a response comes with an array of data.
Here is my code, everything seems to be written as it should be, sorry for the nesting, it has not yet reached the tidying up. Not all the code is here, since there is also a loader, etc. I will give only the code for sending the picture to VK
if (response.success) {
var fullUrl = response.fullUrl;
VK.api('photos.getWallUploadServer', {
gid: groupId,
}, function (data) {
// уже вот тут получается ошибка(((
console.log(data);
if (data.response) {
$.post('uploadimage.php', {
upload_url: data.response.upload_url,
imglink: fullUrl
}, function (json) {
//console.log(json);
VK.api("photos.saveWallPhoto", {
server: json.server,
photo: json.photo,
hash: json.hash,
gid: groupId
}, function (data) {
attachments.push(data.response['0'].id);
//console.log(attachments);
});
}, 'json');
}
});
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question