4
4
4sadly2020-05-05 20:14:39
In contact with
4sadly, 2020-05-05 20:14:39

Why is node.js not sending the file?

let form = new FormData()
            form.append('photo', fs.createReadStream('tmp.jpg'))
            await fetch(server.upload_url, {
                method: 'POST',
                body: form,
                headers: { 'Content-Type': 'multipart/form-data' }
            })

I want to upload a photo to the server in order to use the photos.saveMessagesPhoto method, but when uploading photos, the photos field is empty, photos are not sent

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Didenko, 2020-05-05
@Dasslier

What fetch is used? Node.js needs a separate package, because by regular fetch - browser

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question