Answer the question
In order to leave comments, you need to log in
How to upload a VKontakte file with a POST request?
I don’t understand a little how to send POST requests from Node.js along with a picture, for example, if I try to upload, I get an empty parameter
Answer the question
In order to leave comments, you need to log in
const fs = require('fs');
const request = require('request');
const url = 'https://pu.vk.com/c638131/upload.php?_query=eyJhY3QiO...';
const formData = {
photo: fs.createReadStream('test.jpg'),
};
request.post({url, formData}, (error, httpResponse, body) => {
if (error) {
return console.error(error);
}
console.log(body);
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question