Skip to content
Discussion options

You must be logged in to vote

Figured it out and updated repo https://github.com/half-metal/image-upload

I was having trouble with two items

  1. +server.js uses "new Response" for some reason
//return { filename: file.name }; this would work with +page.server.js (which to me is confusing diff behavior)
return new Response(JSON.stringify({filename: file.name}) ); //this works for +server.js
  1. I changed the multipart form to look like this
    <form method="post" enctype="multipart/form-data" action="upload-image">
    where the action is using the api, and including the enctype

This does what I wanted, although confused why Sveltekit navigates to the action page.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by half-metal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant