pqina / svelte-filepond

🔌 A handy FilePond adapter component for Svelte
MIT License
247 stars 10 forks source link

Sapper integration #2

Closed myangga closed 3 years ago

myangga commented 3 years ago

Hi, having some issues with Filepond integration to Sapper (Svelte JS framework).

First because following the install steps leads to 500 error because of non SSR component. So I added Filepond and svelte-filepond packages as dev dependencies:

npm install -D svelte-filepond filepond

Then all seems to work execpt that I don't succeed to get the file serverId... Still get undefined (returning all page HTML). I did create a Git repo to test and reproduce here: https://github.com/myangga/sapper-filepond

Thanks for support.

myangga commented 3 years ago

BTW, forgot to add "express-fileupload" to be able to load/process file on server, and added reference inside server.js. Now you can see uploaded file in /tmp/ folder of host platform (setup in server.js). But still the serverid is not returned.

rikschennink commented 3 years ago

Hi, I don't have any experience with Sapper or express-fileupload. What I can tell you is that FilePond pushes posts a formdata object that contains both a file metadata string and a file blob (see: https://pqina.nl/filepond/docs/patterns/api/server/#introduction).

Make sure the server end point returns a plain text response with a unique file id.

myangga commented 3 years ago

I succeeded to use it finally, by grabing the tempFilePath via the req parameter in upload async process I created, and forwarding the file name as serverid. Thanks