Archived from the Transloadit support forum. Originally posted on January 3, 2012; details may be outdated, see our docs for current behavior. Original thread
My site was crippled this morning because I used jquery.transloadit2.js in an undocumented way, which broke when you deployed https://github.com/transloadit/jquery-sdk/commit/REDACTED. I wanted to trigger an upload automatically after the user selects a file, without also submitting the form. (I cannot call submit() on the form because the user may also use the form to enter a message without uploading attachments, so the action attribute of my form does not point to transloadit, but to my own server; consequently, the submit event will submit the form even though I set transloadit’s autosubmit option to false.)
What I did was the following:
$('form input[type=file]').live('change', function(event) {
$(this).closest('form').transloadit('getBoredInstance');
});
This broke because the new version requires that validate() and detectFileInputs() be called before getBoredInstance():
$('form input[type=file]').live('change', function(event) {
$(this).closest('form').transloadit('validate');
$(this).closest('form').transloadit('detectFileInputs');
$(this).closest('form').transloadit('getBoredInstance');
});
To avoid similar breakage in the future, is there a supported way of doing what I want? For instance, should I be calling trigger('submit.transloadit') on the form?
Thanks,
Vebjorn