- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在我的 gemfile 中使用它:gem 'remotipart'
在我的表单 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%>
Controller 方法:
def create
respond_to do |format|
if @user.save
format.js
end
end
end
和我的create.js.erb
<% if remotipart_submitted? %>
alert('submitted via remotipart')
<% else %>
alert('error in uploading image')
<% end %>
它在服务器中给出此错误413:请求实体太大,但没有在页面中显示它,它没有获取我的警报消息,即无法捕获错误。请帮我找到方法。不想给这个 client_max_body_size 2M;
使用 Rails 应用程序处理其错误,它从 nginx 请求获取错误不会通过 Rails 应用程序
最佳答案
关于javascript - gem 'remotipart' 在服务器 Rails 4 中不显示错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30024839/
我正在使用 remotipart 插件进行 Ajax 图片上传。最近我将 Rails 版本从 3.1.10 升级到 3.2.13。升级 rails 版本后,我发现 ajax 图片上传不起作用。 我有使
我是一名新的 RoR 程序员,在我使用 remotipart 上传文件并将其与 POST 请求一起提交给 Controller 后,我目前正试图让我的 js 工作。基本上,单击提交按钮后,POST 请
使用 Ruby on Rails 4 和 Ruby 2。 这是我的简单 Controller 操作。当验证失败时,我呈现"new"操作并将 View 的内容注入(inject) .ajax-targe
我正在使用 remotipart 使用 ajax 上传和升级图像,问题是当我编辑项目时,ajax 更新数据,但 remotipart(https://github.com/leppert/remoti
我构建了一个 Web 服务,它使用 remotipart gem 将文件上传到服务器。用于传输数据的形式是ajax形式(remote => true)。一切正常,文件被保存等。 问题是,jquery
当用 jquery 和 rails 替换 html 时(在 4.0.4 上测试),以下工作: replace.js.erb的内容 $('#my_div').html(""); _my_partial.
看起来 Remotipart 实际上并未用于提交我的表单,因此当我查看表单提交到的参数时,图像完全被遗漏了。 remotipart_subscribed? 返回 false params: {"utf
我在我的 gemfile 中使用它:gem 'remotipart' 在我的表单 View new.html.erb中定义 'file_browse' %>
我正在尝试使用 ajax 将文件上传到我的 Rails 应用程序。为方便起见,我包含了 jQuery.remotipart gem . // app/assets/javascripts/applic
我一直在努力让 AJAX 上传表单工作。我正在使用 Rails 3.2。我把gem "remotipart", "~> 1.0"在我的 Gemfile 中,运行 bundle install并且安装成
我正在尝试实现一个基于 ajax 事件的进度条,我在许多来源中都读到过。我的特殊问题是我不知道如何将我的自定义事件处理程序绑定(bind)到“remotipart”gem 的 ajax 事件中。 这是
Rails 5 和载波 我加: gem 'remotipart', '~> 1.3.1' 和 //= require jquery.remotipart 我有这样的表格: = simple_form_
我是一名优秀的程序员,十分优秀!