Replies: 1 comment
-
Worked around the issue by implementing chunked upload through the WebSocket, and it's actually much nicer than a regular form could ever be, so I guess this is resolved :) Still, for for future reference / fallback method / for anyone else struggling with file uploads, it'd be curious to know if file uploads are currently bugged or if not, how exactly should they be handled since things have got a bit confusing with the recent std/http-native transition. Just a thought, maybe it would be nice idea to have a maintained, "official" middleware helper that would automatically detect request format and parse any sent form data, including file handles, post data for easy access? Like context.post = {field: value}, context.get = {field: value}, context.files = (file entries in some suitable format) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi!
Not sure if bug or lack of knowledge in my part, but I have trouble getting file uploads to work using latest Oak. I am unable to find a working documentation or examples. What examples I have found are maybe outdated or otherwise not working. Things I have tried:
The following works for other post data, but how would I go about getting a handle on uploaded files?
Above code, when used on a multipart/form-data request, results in TypeError: (intermediate value) is not iterable for reading the body. Curiously, when reloading (resubmitting) the form from Firefox by hitting F5, the error changes to 400 Bad request (malformed MIME header line: -----------------------------32864566898151169101143986297).
The form looks like this:
Using Oak 9.0.0 with Deno 1.13.2. (if it matters, I use HttpServerStd constructor because websockets appear to not work with HttpServerNative)
Beta Was this translation helpful? Give feedback.
All reactions