Currently, I have included the 'remotipart' gem in my Gemfile like this: gem 'remotipart'
This is defined in my form view new.html.erb
<%=form_for @user, remote: true, html: { multipart: true, class: 'user-form' } do |f| %>
<div id='file_browse'>
<%= f.file_field :image, :id => 'file_browse' %>
</div>
<div class="actions">
<%= f.submit %>
</div>
<%end%>
The Controller method looks like this :
def create
respond_to do |format|
if @user.save
format.js
end
end
end
Next, I have a file called create.js.erb which contains:
<% if remotipart_submitted? %>
alert('submitted via remotipart')
<% else %>
alert('error in uploading image')
<% end %>
However, when attempting to use this setup, I encountered an error with code 413: Request Entity Too Large. Despite this error occurring at the server level, it does not display on the page. As a result, my alert message is not being triggered to catch the error. I am seeking assistance in resolving this issue without resorting to using client_max_body_size 2M;
as a workaround. The main challenge is that the error stems from nginx directly and bypasses the Rails application.