Skip to content

Commit 5904d38

Browse files
committed
jquery-form#180; upload empty file input
1 parent f3d7871 commit 5904d38

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

jquery.form.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*!
22
* jQuery Form Plugin
3-
* version: 3.08 (07-APR-2012)
3+
* version: 3.09 (16-APR-2012)
44
* @requires jQuery v1.3.2 or later
55
*
66
* Examples and documentation at: http://malsup.com/jquery/form/
@@ -21,7 +21,7 @@
2121
to bind your own submit handler to the form. For example,
2222
2323
$(document).ready(function() {
24-
$('#myForm').bind('submit', function(e) {
24+
$('#myForm').on('submit', function(e) {
2525
e.preventDefault(); // <-- important
2626
$(this).ajaxSubmit({
2727
target: '#output'
@@ -808,8 +808,14 @@ $.fn.formToArray = function(semantic, elements) {
808808
if (elements)
809809
elements.push(el);
810810
var files = el.files;
811-
for (j=0; j < files.length; j++) {
812-
a.push({name: n, value: files[j], type: el.type});
811+
if (files.length) {
812+
for (j=0; j < files.length; j++) {
813+
a.push({name: n, value: files[j], type: el.type});
814+
}
815+
}
816+
else {
817+
// #180
818+
a.push({ name: n, value: '', type: el.type });
813819
}
814820
}
815821
else if (v !== null && typeof v != 'undefined') {

0 commit comments

Comments
 (0)