Skip to content

How to upload a file from the client or from postman to the server? #667

Closed Answered by kitsonk
willantunes asked this question in Q&A
Discussion options

You must be logged in to vote

You are using the "old" API for accessing the request body (prior to version v13) but you are using the "latest" version of oak by not being explicit in what version you are using. With versions of oak v13 and later you have to use the correct API as per the documentation: https://jsr.io/@oak/oak/doc/body/~/Body (which is what the error is indicating to you too, that you aren't using the API correctly).

If you want the form data, it would be something like:

const body = await context.request.body.formData();

Or use a version of oak prior to v13.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by kitsonk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #666 on August 01, 2024 22:12.