soyjeansoy
Plug.Parsers.RequestTooLargeError when uploading large files
Hi, how can i upload large file? it throws Plug.Parsers.RequestTooLargeError even though i added length in Plug.Parsers.
# endpoint.ex
plug Plug.Parsers,
parsers: [
:urlencoded,
{:multipart, length: 100_000_000},
:json
],
length: 100_000_000,
pass: ["*/*"],
json_decoder: Phoenix.json_library()
My heex template form has multipart and file_input/3 has multiple attribute. I’m uploading 3 files, no larger than 5mb each and it throws this:
Plug.Parsers.RequestTooLargeError at POST /upload
the request is too large. If you are willing to process larger requests, please give a :length to Plug.Parsers
lib/plug/parsers.ex
350
351 {:next, conn} ->
352 reduce(conn, rest, type, subtype, params, pass, query_string_length, validate_utf8)
353
354 {:error, :too_large, _conn} ->
355 raise RequestTooLargeError
356 end
357 end
358
359 defp reduce(conn, [], type, subtype, _params, pass, query_string_length, validate_utf8) do
360 if accepted_mime?(type, subtype, pass) do
Tried also uploading a single file that’s 20mb and still throws the same error. What did i miss?
Most Liked
LostKobrakai
For something smallish it does make sense to update the limits, but for larger uploads (imo start at ~30-50 MB) I’d suggest using streamed (e.g. LV uploads) or chunked uploads (e.g. tus protocol).
LostKobrakai
Even with a dedicated storage system there’s benefit in chunked uploads though – especially around the ability to reupload on failures.
kokolegorille
Last Post!
apoorv-2204
what about the info if we want to give to user , like flash , saying this is the upload limit.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #hex










