[CLOSED] File upload fails on form.submit

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [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:
     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:

    Click image for larger version. 

Name:	Ext file.png 
Views:	62 
Size:	18.1 KB 
ID:	25371

    But errors out at this line:

    Click image for larger version. 

Name:	ext error.png 
Views:	59 
Size:	45.4 KB 
ID:	25372

    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.

Similar Threads

  1. Replies: 4
    Last Post: Jan 13, 2015, 8:21 AM
  2. File upload field form redirect to another razor
    By chinninani in forum 2.x Help
    Replies: 2
    Last Post: Jun 27, 2013, 9:12 AM
  3. [CLOSED] Multiple file support to upload in file upload control
    By legaldiscovery in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Feb 01, 2013, 9:41 AM
  4. Replies: 1
    Last Post: Jun 23, 2011, 9:37 AM
  5. [CLOSED] Submit gridpanel data in form submit
    By jchau in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jul 14, 2010, 7:25 PM

Posting Permissions