My environment
[Svelte] --FormData submit--> [SvelteKit Endpoint] --call for save file --> [Rails]
Describe the issue
I uploaded the file and submitted the form to the SvelteKit Endpoint. Then I passed FormData from SvelteKit to Rails by Axios get error "Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream"
Example Code
Code snippet to illustrate your question
[svelte]
<form
on:submit
method="post"
enctype="multipart/form-data"
action="/api/reports"
>
<Fileupload name="report[thumbnail]" size="sm" accept="image/png, image/jpeg" />
</form>
[sveltekit endpoint]
export const POST: RequestHandler = async ({ request, locals }) => {
const form = await request.formData(); // get formData
const response = await axios.post(`${url}`, data) // send form data
};
Expected behavior, if applicable
I think can send FormData value to Rails server
Environment
"axios": "^0.27.2",
"@sveltejs/adapter-node": "1.0.0-next.88",
"@sveltejs/kit": "next",
Additional context/Screenshots
