Auto upload files

Public

Source: http://worldofdrupal.blogspot.fr/2014/08/ajax-image-uploader-in-drupal-7...

Get raw version
javascript
  1. (function ($) {
  2. Drupal.behaviors.autoUpload = {
  3. attach: function (context, settings) {
  4. $('form', context).delegate('input.form-file', 'change', function() {
  5. $(this).next('input[type="submit"]').mousedown();
  6. });
  7. }
  8. };
  9. })(jQuery);