function doSubmit() {
      // make sure form attrs are set
      var t = $form.attr('target'), a = $form.attr('action');

      // update form attrs in IE friendly way
      form.setAttribute('target',id);
      if (form.getAttribute('method') != 'POST') {
        form.setAttribute('method', 'POST');
      }
      if (form.getAttribute('action') != s.url) {
        form.setAttribute('action', s.url);
      }

      // ie borks in some cases when setting encoding
      if (! s.skipEncodingOverride) {
        $form.attr({
          encoding: 'multipart/form-data',
          enctype:  'multipart/form-data'
        });
      }

      // support timout
      if (s.timeout) {
        setTimeout(function() { timedOut = true; cb(); }, s.timeout);
      }

      // add "extra" data to form if provided in options
      var extraInputs = [];
      try {
        if (s.extraData) {
          for (var n in s.extraData) {
            extraInputs.push(
              $('<input type="hidden" name="'+n+'" value="'+s.extraData[n]+'" />')
                .appendTo(form)[0]);
          }
        }

        // add iframe to doc and submit the form
        $io.appendTo('body');
        $io.data('form-plugin-onload', cb);
        form.submit();
      }
      finally {
        // reset attrs and remove "extra" input elements
        form.setAttribute('action',a);
        if(t) {
          form.setAttribute('target', t);
        } else {
          $form.removeAttr('target');
        }
        $(extraInputs).remove();
      }
    }
function doSubmit() {
      
      var t = $form.attr('target'), a = $form.attr('action');

      
      form.setAttribute('target',id);
      if (form.getAttribute('method') != 'POST') {
        form.setAttribute('method', 'POST');
      }
      if (form.getAttribute('action') != s.url) {
        form.setAttribute('action', s.url);
      }

      
      if (! s.skipEncodingOverride) {
        $form.attr({
          encoding: 'multipart/form-data',
          enctype:  'multipart/form-data'
        });
      }

      
      if (s.timeout) {
        setTimeout(function() { timedOut = true; cb(); }, s.timeout);
      }

      
      var extraInputs = [];
      try {
        if (s.extraData) {
          for (var n in s.extraData) {
            extraInputs.push(
              $('<input type="hidden" name="'+n+'" value="'+s.extraData[n]+'" />')
                .appendTo(form)[0]);
          }
        }

        
        $io.appendTo('body');
        $io.data('form-plugin-onload', cb);
        form.submit();
      }
      finally {
        
        form.setAttribute('action',a);
        if(t) {
          form.setAttribute('target', t);
        } else {
          $form.removeAttr('target');
        }
        $(extraInputs).remove();
      }
    }
function doSubmit ( ) { // make sure form attrs are set var t = $form . attr ( 'target' ) , a = $form . attr ( 'action' ) ; // update form attrs in IE friendly way form . setAttribute ( 'target' , id ) ; if ( form . getAttribute ( 'method' ) != 'POST' ) { form . setAttribute ( 'method' , 'POST' ) ; } if ( form . getAttribute ( 'action' ) != s . url ) { form . setAttribute ( 'action' , s . url ) ; } // ie borks in some cases when setting encoding if ( ! s . skipEncodingOverride ) { $form . attr ( { encoding : 'multipart/form-data' , enctype : 'multipart/form-data' } ) ; } // support timout if ( s . timeout ) { setTimeout ( function ( ) { timedOut = true ; cb ( ) ; } , s . timeout ) ; } // add "extra" data to form if provided in options var extraInputs = [ ] ; try { if ( s . extraData ) { for ( var n in s . extraData ) { extraInputs . push ( $ ( '<input type="hidden" name="' + n + '" value="' + s . extraData [ n ] + '" />' ) . appendTo ( form ) [ 0 ] ) ; } } // add iframe to doc and submit the form $io . appendTo ( 'body' ) ; $io . data ( 'form-plugin-onload' , cb ) ; form . submit ( ) ; } finally { // reset attrs and remove "extra" input elements form . setAttribute ( 'action' , a ) ; if ( t ) { form . setAttribute ( 'target' , t ) ; } else { $form . removeAttr ( 'target' ) ; } $ ( extraInputs ) . remove ( ) ; } }
take a breath so that pending repaints get some cpu time before the upload starts
take a breath so that pending repaints get some cpu time before the upload starts