Jun 24, 2020, 8:57 PM
[CLOSED] File upload fails on form.submit
Hi Fabricio,
I am now upgrading another project in the same solution as the previous one, this time from 4.2 -> 5.
We have a form we're using for file uploads, with this call:
It reaches this file:
But errors out at this line:
I am going to assume that the ext.axd file is well vetted and bullet-proof, so there must be something wrong with the form being submitted. I just don't know where to look. Somehow the "key" is not allowed to null or undefined, yet it is.
I will supply more info a bit later.
Thanks, Bob Graham
I am now upgrading another project in the same solution as the previous one, this time from 4.2 -> 5.
We have a form we're using for file uploads, with this call:
onUpload: function (button, e, options) {
debugger;
var form = this.lookup('upload-form').getForm();
if (form.isValid()) {
var vm = this.getViewModel();
var store = vm.get('attachmentStore');
var record = store.findRecord('docType', form.getFieldValues().documentType);
if (record && !record.get('checkedOutBy') && record.get("documentId") > 0
&& (form.getFieldValues().documentType != "N/A")) {
Ext.Msg.confirm('Confirm', 'Are you sure you want to remove previous file ?', function (choice) {
if (choice === 'yes') {
form.submit({
clientValidation: true,
url: '../../api/files/upload',
headers: { 'app': 'tlt' },
method: 'POST',
scope: this,
success: 'onSaveSuccess',
failure: 'onSaveFailure'
});
}
}, this);
}
else if (record && record.get('checkedOutBy')) {
Ext.Msg.alert('Alert', 'The previous version is checked out by ' + record.get('checkedOutBy')
+ ' You cannot upload another file for this Document Type');
return;
}
else {
form.submit({
clientValidation: true,
url: '../../api/files/upload',
method: 'POST',
scope: this,
success: 'onSaveSuccess',
failure: 'onSaveFailure'
});
}
}
},
vm, store, and record all grab the proper values. The "record" is to grab any existing files and ask the user if the want to replace them, so we're only interested in the third option, the "else."It reaches this file:
But errors out at this line:
I am going to assume that the ext.axd file is well vetted and bullet-proof, so there must be something wrong with the form being submitted. I just don't know where to look. Somehow the "key" is not allowed to null or undefined, yet it is.
I will supply more info a bit later.
Thanks, Bob Graham
Last edited by fabricio.murta; Jun 26, 2020 at 11:32 PM.