Answer the question
In order to leave comments, you need to log in
How to upload a picture to VK using the https module?
There is an implementation of uploading files to VK using the request module. How to do the same using the standard https module?
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);
});
Answer the question
In order to leave comments, you need to log in
const https = require('https');
const agent = new http.Agent({});
const options = {
// method
// url => {
// protocol
// hostname
// }
// headers
// body
};
agent.request(options, cb);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question