V
V
vityas-off2018-11-05 14:05:20
In contact with
vityas-off, 2018-11-05 14:05:20

Loading photo vk api, empty "photos_list"?

This is not a question, this is already an answer that I am writing in case someone encounters the same problem, because the answer is not googled, and the description of the VK api simply does not say that you need to specify the file name.
How it doesn't work (a similar example can be found in the documentation of the request module):

const res = await this.req.post({
      ...this.options,
      url: this.ulpoadUrl,
      formData: {
        file1: await readFile(path),
      },
    });

How to:
const res = await this.req.post({
      ...this.options,
      url: this.ulpoadUrl,
      formData: {
        file1: {
          value: await readFile(path),
          options: { filename: 'dwadawd.jpeg' },
        },
      },
    });

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladlen Hellsite, 2018-11-05
@vityas-off

How about ready implementation ?

const { VK } = require('vk-io');

const vk = new VK({
  token: ...
});

// ...

const attachments = await vk.upload.photoAlbum({
  source: [path]
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question