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).
2
LostKobrakai
Even with a dedicated storage system there’s benefit in chunked uploads though – especially around the ability to reupload on failures.
1
kokolegorille
Yes, but waffle is not the reason…
1
Popular in Questions
Hi, I’m just starting to build a side-project with Elixir and Phoenix and doing some basic test with Elixir alone.
What strikes me is th...
New
Hello, I have map which I want to convert it to string like this:
the map:
%{last_name: "tavakkoli", name: "shahryar"}
the string I ne...
New
I am trying to figure out how Mix knows whether the environment is test, dev, or prod -- where is this set?
Thanks.
New
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
I've read in another post that it may be possible with a router helper - but I couldn't find an appropriate one, and tbh, I'm still just ...
New
In templates/appointment/index.html.eex:
<%= for appointment <- @appointments do %>
<tr>
<td><%= appoi...
New
I tried installing
elixir 1.11.2
erlang 23.3.4
via asdf in my zsh shell. Enabled the versions locally and globally.
When I list them ...
New
Hi guys, i’m new in the Elixir world, and i have to say, that i love it!
i’m having some problem to understand anonymous functions with ...
New
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]
15:22:35.803 [error] gen_event {lager_file_backend...
New
Hi everyone!
I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
Other popular topics
Hello everyone,
I try to use an Javascript Event Handler in my root.html.leex file.
Therefore I created a function in the app.js file: ...
New
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum.
...
New
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
Hi everyone!
I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New







