0.14 breaks FormData file serialisation
plushdohn opened this issue ยท 3 comments
Describe the bug
Version 0.14 and above seems to have broken file uploads done via a server action's formData
argument. File
s on a Node server get serialised and look like an [object File]
instead of an actual File
so it's impossible to get the underlying buffer anymore.
This single commit bd9f19a seems to be causing the bug as undoing those precise changes fixes the issue.
Your Example Website or App
Steps to Reproduce the Bug or Issue
- Create a
<form>
that uses a server action from the router and has a file input - Do a
formData.get("file")
on the server and console.log the output - Revert to 0.13.6 to fix the bug
Expected behavior
I know there are limitations in file upload via FormData
but I'd expect the default behaviour to work
Screenshots or Videos
No response
Platform
- OS: macOS
- Browser: Chrome
- Version: 0.14.1
Additional context
I'd gladly make a PR but I don't have context on why the initial change was made.
I think your form just misses the enctype="multipart/form-data"
attribute for file uploads. Before 0.14 all forms where implicitly sent with this attribute which was inconsistent with the html standard ๐
.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/enctype
Goes into more detail about this
I think your form just misses the
enctype="multipart/form-data"
attribute for file uploads. Before 0.14 all forms where implicitly sent with this attribute which was inconsistent with the html standard ๐ .https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/enctype Goes into more detail about this
TIL about enctype
, cheers!