Permalink
Browse files

#180; upload empty file input

  • Loading branch information...
1 parent f3d7871 commit 5904d38c2636bf037c8328aab6576361af53da75 @malsup committed Apr 16, 2012
Showing with 10 additions and 4 deletions.
  1. +10 −4 jquery.form.js
View
14 jquery.form.js
@@ -1,6 +1,6 @@
/*!
* jQuery Form Plugin
- * version: 3.08 (07-APR-2012)
+ * version: 3.09 (16-APR-2012)
* @requires jQuery v1.3.2 or later
*
* Examples and documentation at: http://malsup.com/jquery/form/
@@ -21,7 +21,7 @@
to bind your own submit handler to the form. For example,
$(document).ready(function() {
- $('#myForm').bind('submit', function(e) {
+ $('#myForm').on('submit', function(e) {
e.preventDefault(); // <-- important
$(this).ajaxSubmit({
target: '#output'
@@ -808,8 +808,14 @@ $.fn.formToArray = function(semantic, elements) {
if (elements)
elements.push(el);
var files = el.files;
- for (j=0; j < files.length; j++) {
- a.push({name: n, value: files[j], type: el.type});
+ if (files.length) {
+ for (j=0; j < files.length; j++) {
+ a.push({name: n, value: files[j], type: el.type});
+ }
+ }
+ else {
+ // #180
+ a.push({ name: n, value: '', type: el.type });
@ybart
ybart Dec 11, 2012

Probable cause of #251

}
}
else if (v !== null && typeof v != 'undefined') {

0 comments on commit 5904d38

Please sign in to comment.