Closed aaronshim closed 7 years ago
When I make a new Rails 5 app, add the line gem 'jquery-fileupload-rails' to the Gemfile, and then insert the following code into a view
gem 'jquery-fileupload-rails'
<input id="fileupload" type="file" name="files[]" multiple> <script> $('#fileupload').fileupload({ dataType: 'json', done: function (e, data) { alert('done'); }, add: function (e, data) { alert('Uploading...'); } }); </script>
the upload widget does not trigger the alert when I add a file to upload. Furthermore, the drag and drop add is not working. My application.js looks like this:
application.js
//= require jquery //= require jquery_ujs //= require jquery-fileupload //= require jquery-fileupload/basic //= require turbolinks //= require_tree .
What could be the problem? The HTML and javascript code, when pasted into a blank HTML file, works.
Works for me. You shouldn't require both "jquery-fileupload" and "jquery-fileupload/basic". If you want the basic uploader, just use the latter.
When I make a new Rails 5 app, add the line
gem 'jquery-fileupload-rails'
to the Gemfile, and then insert the following code into a viewthe upload widget does not trigger the alert when I add a file to upload. Furthermore, the drag and drop add is not working. My
application.js
looks like this:What could be the problem? The HTML and javascript code, when pasted into a blank HTML file, works.