Skip to content

Commit d235e9a

Browse files
committed
jquery-form#380; reset form enctype attribute
1 parent 93d0bd6 commit d235e9a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

jquery.form.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
// AMD support
1414
(function (factory) {
15+
"use strict";
1516
if (typeof define === 'function' && define.amd) {
1617
// using AMD; register as anon module
1718
define(['jquery'], factory);
@@ -491,7 +492,10 @@ $.fn.ajaxSubmit = function(options) {
491492
// take a breath so that pending repaints get some cpu time before the upload starts
492493
function doSubmit() {
493494
// make sure form attrs are set
494-
var t = $form.attr2('target'), a = $form.attr2('action');
495+
var t = $form.attr2('target'),
496+
a = $form.attr2('action'),
497+
mp = 'multipart/form-data',
498+
et = $form.attr('enctype') || $form.attr('encoding') || mp;
495499

496500
// update form attrs in IE friendly way
497501
form.setAttribute('target',id);
@@ -573,6 +577,7 @@ $.fn.ajaxSubmit = function(options) {
573577
finally {
574578
// reset attrs and remove "extra" input elements
575579
form.setAttribute('action',a);
580+
form.setAttribute('enctype', et); // #380
576581
if(t) {
577582
form.setAttribute('target', t);
578583
} else {

0 commit comments

Comments
 (0)