geeky notes on web (drupal) and .net (c#) programming, whichever prevails at the moment

 

All commits tagged "js"

 

Imagefield: automatically transfer file on selection without clicking upload button

I wanted file to be uploaded automatically after selecting it, without having to press the Upload button:

Here my solution to this problem, which seems to be working better than the one in the filefield issue queue on d.o:

Drupal.behaviors.Autoupload = function(context) {
  $(context, '.filefield-upload input.form-file').change(function(context) {
    $(context.target).parent().find('input.form-submit:not(.au)').addClass("au").mousedown();
  });
}

}