tors / jquery-fileupload-rails

jQuery File Upload integrated for Rails
669 stars 254 forks source link

Widget not working in Rails 5? #91

Closed aaronshim closed 7 years ago

aaronshim commented 8 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

<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:

//= 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.

felixbuenemann commented 8 years ago

Works for me. You shouldn't require both "jquery-fileupload" and "jquery-fileupload/basic". If you want the basic uploader, just use the latter.