From ec209ecf95236c9c347a41b19cb507fa16e1f055 Mon Sep 17 00:00:00 2001 From: Joe Vu Date: Tue, 18 Mar 2014 13:21:16 -0700 Subject: [PATCH] Update backbone-model-file-upload.js Fix some updates to the "formData" logic --- backbone-model-file-upload.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/backbone-model-file-upload.js b/backbone-model-file-upload.js index ae26a21..6c9d4aa 100644 --- a/backbone-model-file-upload.js +++ b/backbone-model-file-upload.js @@ -40,10 +40,11 @@ this.attributes = _.extend({}, attributes, attrs); } - // Check for "allowFormData" flag and if file exist and if so, convert to FormData - if ( options.allowFormData !== false - && this.attributes[ this.fileAttribute ] - && this.attributes[ this.fileAttribute ] instanceof File ) { + // Check for "formData" flag and check for if file exist. + if ( options.formData === true + || options.formData !== false + && this.attributes[ this.fileAttribute ] + && this.attributes[ this.fileAttribute ] instanceof File ) { // Flatten Attributes reapplying File Object var formAttrs = _.clone( this.attributes ), @@ -113,4 +114,4 @@ }); -}(_, Backbone); \ No newline at end of file +}(_, Backbone);