-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: How to upload a file? #35
Comments
You should be able to use
https://github.com/form-data/form-data to do that
Il giorno mar 19 feb 2019 alle 21:48 Cemre Mengu <[email protected]>
ha scritto:
… I would like to upload multipart/form-data using inject. Currently, using this
plugin <https://github.com/huangang/fastify-file-upload#readme> to get
the files but I am unable to do so.
Is this possible?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#35>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/AADL459SLa9wTgJKuNSkDH6RL4a-P1Krks5vPGMUgaJpZM4bD1XO>
.
|
Thank you! Ended up with: const FormData = require('form-data')
const form = new FormData()
form.append('myfile', fs.createReadStream(`./path/to/file`))
const res = await app.inject({
url: '/api/upload'
method: 'POST',
payload: form,
headers: form.getHeaders()
}) |
2 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I would like to upload
multipart/form-data
using inject. Currently, using this plugin to get the files but I am unable to do so.Is this possible?
The text was updated successfully, but these errors were encountered: