Questions tagged [remotipart]

The Remotipart gem enables AJAX file-upload capability to remote forms in Rails 3 apps by extending the native jquery-ujs functionality.

The Remotipart gem enables AJAX file-upload capability to remote forms in Rails 3 apps by extending the native jquery-ujs functionality.

The Remotipart gem does two things:

  1. When non-blank file input fields are detected in a form, remotipart.js hijacks the remote form submission, and instead submits the form using via form.js’s .ajaxSubmit() function, which uses iFrame technique described in the last article.
  2. Remotipart provides the remotipart_response block method in our response js.erb views. This method first checks to see if the form was hijacked by Remotipart and was thus submitted in an iFrame, and if so, it returns our generated JS inside a textarea element, so that it automatically gets executed in our parent window.
37 questions
9
votes
1 answer

Rails 4 not using Remotipart to remotely submit form

It looks like Remotipart isn't actually being used to submit my form, so the image is completely left out when I look at the params where the form gets submitted to. remotipart_submitted? returns false params: {"utf8"=>"✓",…
Tom Prats
  • 7,364
  • 9
  • 47
  • 77
7
votes
4 answers

Uploading image remotely using Rails 5 and Carrierwave

When trying to remotely upload an image via Carrierwave and Rails 5, I'm presented with an encoding error: Encoding::UndefinedConversionError - "\x89" from ASCII-8BIT to UTF-8 I have looked at this answer as well as the activesupport-json_encoder…
HermannHH
  • 1,732
  • 1
  • 27
  • 57
5
votes
2 answers

Rails 5 ajax upload file with remotipart not work (send as HTML instead of JS )

Rails 5 and carrierwave I add: gem 'remotipart', '~> 1.3.1' and //= require jquery.remotipart I have the form: = simple_form_for state, remote: true do |f| = f.input :wsr The output for that form:
3
votes
1 answer

Rails escape_javascript and remotipart

When replacing html with jquery and rails (tested on 4.0.4) the following works: Content of replace.js.erb $('#my_div').html("<%= j(render 'my_partial') %>"); Content of _my_partial.html.erb "This" works <%= '"This" also works' %> However it fails…
Pierre Pretorius
  • 2,869
  • 22
  • 21
3
votes
4 answers

Textarea wrapped around JS when uploading images with remotipart plugin

I am using remotipart plugin to do the Ajax image upload. Recently I upgraded the Rails version from 3.1.10 to 3.2.13. After upgrading rails version I found that ajax image upload is not working. I have form which submits the image using remotipart…
Vishakha
  • 421
  • 4
  • 7
3
votes
0 answers

Rails 3.2 and Remotipart not working in production

I have remotipart in my gem file: gem 'remotipart',:require=>'remotipart' and is not in a group On the development remote uploading with remotipart 1.2.1 works with no issue: <%= form_tag upload_gallery_image_path, :remote => true do %> <%=…
david
  • 195
  • 1
  • 13
2
votes
1 answer

ujs + remotipaart - when running jQuery `.html(...)` calls, the appended html becomes just text

I am using rails 5, with remotipart. The remotipart version is: gem 'remotipart', github: 'mshibuya/remotipart' (At the moment of this question, the current commit is 88d9a7d55bde66acb6cf3a3c6036a5a1fc991d5e). When I want to submit a form having…
Luis Masuelli
  • 12,079
  • 10
  • 49
  • 87
2
votes
0 answers

Preventing uploading of password-protected or corrupt PDF files in Ruby on Rails

I have a ruby on rails 4 app that uses ajax file uploading. Is there a way I can prevent the user from uploading password-protected or corrupt / malformed PDF files? UPDATE: Just saw this post on checking if a PDF is corrupt using pdf-reader gem and…
echo
  • 900
  • 1
  • 9
  • 17
2
votes
0 answers

Rails 4: How can I use "redirect_to" with AJAX to render a partial after uploading file(s)?

I am using carrierwave and remotipart to handle an AJAX form where I upload an album of music and accompanying information to a website. After submitting the form, I would like to redirect the partial where the form was located to the newly created…
Bill Jia
  • 21
  • 2
2
votes
1 answer

Submitting a form with file input using remotipart wraps a textarea to response

Using Ruby on Rails 4 and Ruby 2. Here's my simple controller action. When validation fails I render the 'new' action and inject the contents of the view into the .ajax-target div. $("body").on("ajax:success", '.remote-form', (e, data, status, xhr)…
sergserg
  • 21,716
  • 41
  • 129
  • 182
1
vote
1 answer

How to fix ActionController::InvalidAuthenticityToken with remotipart gem?

I'm getting an error ActionController::InvalidAuthenticityToken when I'm trying to submit an Ajax form with a file attached. I want to fix it with remotipart gem, but the error stays after I add remotipart and add //= require jquery.remotipart right…
Evanto
  • 340
  • 4
  • 19
1
vote
0 answers

How do I use remotipart with paperclip to upload image and show in real time

This is my code remoti.coffe $(document).on "change", "#post_image", (en)-> $(this).submit() _form.haml from post = form_for @post, remote:true do |f| - if @post.errors.any? #error_explanation %h2= "#{pluralize(@post.errors.count,…
Bryan Zamora
  • 131
  • 1
  • 1
  • 6
1
vote
1 answer

CSV download in Rails includes textarea tag - override Remotipart render?

I'm trying to create a CSV file for download in Rails, and cannot get it to send just the CSV without a tag around the data. In my controller, I have: csv_string = CSV.generate do |csv| …
1
vote
1 answer

Uploading files using remote:true and remotipart + carrierwave gems

I want to make remote file upload via remotipart + carrierwave. The problem is that my upload works, but it seems that it is uploaded as usual html. Or it is uploaded via ajax, but appropriate js file is not called. I have a form_for with…
yerassyl
  • 2,958
  • 6
  • 42
  • 68
1
vote
0 answers

rails file uploading via AJAX with refile and remotipart + private_pub involved

I have a rails app with a real time chat (1v1). I'd like to implement a file upload function via AJAX where on submitting the file upload form the filename will show up in the chat without full page reload. I'm trying to use remotipart gem to be…
Sean Magyar
  • 2,360
  • 1
  • 25
  • 57
1
2 3