You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I post a standard HTML form it adds all form fields into _POST even if they are empty. The plugin only sends fields with data. Can an option be added such as uploadEmptyExtraData: true that would mirror the standard HTML form post?
The text was updated successfully, but these errors were encountered:
The plugin does not understand what all you need to submit.
You (the developer) needs to set all form variables OR any additional variables in uploadExtraData. This will be submitted via $_POST. You can also set uploadExtraData as a callback.
If I set:
uploadExtraData: { first_name: 'Kartik', middle_initial: '', last_name: ' Visweswaran'},
The plugin passes only the first_name and last_name fields because the middle_initial is an empty string.
If I had a basic HTML form that did not use this plugin, and filled out the form the same way, I would receive all 3 fields in the $_POST variable and the $_POST[ 'middle_initial' ] will contain an empty string.
The plugin will not send any form elements who value is an empty string in uploadExtraData, see code below from fileinput.js starting on line 862
uploadExtra: function(fd) {
var self = this, data = self.getExtraData();
if (data.length == 0) {
return;
}
$.each(data, function(key, value) {
if (!isEmpty(key) && !isEmpty(value)) { // THIS IS WHERE IT BLOCKS ALL EMPTY FIELDS
fd.append(key, value); // FROM BEING ADDED TO $_POST
}
});
},
When I post a standard HTML form it adds all form fields into _POST even if they are empty. The plugin only sends fields with data. Can an option be added such as uploadEmptyExtraData: true that would mirror the standard HTML form post?
The text was updated successfully, but these errors were encountered: