#how can I get the form data?

9 messages · Page 1 of 1 (latest)

fiery tiger
fluid osprey
#

Assuming the data was posted to your api endpoint with the content-type "multipart/form-data", you can use await request.formdata() to get a FormData object.

#

The formData() method of the Request interface
reads the request body and returns it as a promise that resolves with a FormData object.

The FormData interface provides a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using the fetch() or XMLHttpRequest.send() method. It uses the same format a form would use if the encoding type were set to "multipart/form-data".

Astro Documentation

Learn how to create endpoints that serve any kind of data

fiery tiger
#

is it possible to get the image data?

fiery tiger
fluid osprey
#

not sure what you are asking. or what problem you are facing.

#

it would help if you post the actual code snippets, just the relevant lines. and what you expect the output to be and what you are getting.