Results 1 to 2 of 2

Thread: Form Post With Upload doesn't reach server

  1. #1
    Sencha User
    Join Date
    May 2015
    Posts
    1
    Vote Rating
    0
      0  

    Default Form Post With Upload doesn't reach server

    Hi All,

    I'm using ExtDirect in my Application and all worked perfectly except form upload with multipart data.
    In fact, the program can't reach method in server (trying to debug) when submitting the form. Any error is raised in browser console and Response code is 200 (OK).
    Could you please advise ?

    Here is my code:


    • Client Side


    Code:
    {
        xtype: 'form',
        border: false,
        hidden: true,
        itemId: 'ReportTemplateEditingForm',
        layout: 'fit',
        header: false,
        fileUpload: true,
        title: '${menu.admin.reporttemplate}',
        items: [
            {
                xtype: 'fieldset',
                itemId: 'setGeneral',
                defaults: {
                    labelWidth: 300,
                    labelStyle: 'font-size: 11px; font-weight: bold;',
                    fieldStyle: 'font-size: 11px;',
                    anchor: '100%'
                },
                collapsible: true,
                items: [
                    {
                        xtype: 'textfield',
                        itemId: 'templateDescription',
                        fieldLabel: 'Template Description',
                        name: 'templateDescription',
                        allowBlank: true,
                        enforceMaxLength: true,
                        maxLength: 255
                    },
                    {
                        xtype: 'filefield',
                        name: 'templateFile',
                        buttonOnly: false,
                        fieldLabel: 'Template File',
                        msgTarget: 'side',
                        allowBlank: false,
                        buttonText: 'Select Template...'
                    }
                ]
            }
        ],
        api: {
            submit: reportTemplateAction.uploadTemplate
        },
        dockedItems: [
            {
                xtype: 'editingtoolbar',
                save: function(button) {
                    var me = button,
                        tb = me.up('editingtoolbar'),
                        form = me.up('form').getForm();
                   
                    form.submit({
                        waitMsg: 'Uploading your files...',
                        success: function(form, action) {
                            //textArea1.setValue(action.result.fileContents);
                            console.log('File uploaded !');
                        }
                    });
                },
                editJurisdiction: [
                    'jur_folder_update'
                ],
                dock: 'bottom'
            }
        ]
    }

    • Direct REMOTING_API (api.js)

    Code:
    Ext.ns('Ext.app');Ext.app.REMOTING_API = {"url":"...","type":"remoting","actions":{"reportTemplateAction":[{"name":"findReportTemplate","len":1},{"name":"read","len":1},{"name":"downloadReportTemplate","params":["templateId"]},{"name":"save","len":1},{"name":"uploadTemplate","len":0,"formHandler":true}], .....},"timeout":60000};


    • Server Side

    Code:
    @ExtDirectMethod(ExtDirectMethodType.FORM_POST)
    public ExtDirectFormPostResult uploadTemplate(HttpSession session,
            @RequestParam(value = "templateFile", required = true) MultipartFile templateFile,
            @RequestParam(value = "templateDescription", required = false) String templateDescription) {
    
        ExtDirectFormPostResult response = new ExtDirectFormPostResult(true);
        // file will be process here
        // ...
        
        return response;
    }

  2. #2
    Sencha User
    Join Date
    May 2015
    Posts
    1
    Vote Rating
    0
      0  

    Default

    Hi, All is working as well. For information issue was not related to ExtDirect but to Spring configuration of bean MultipartResolver. Regards, Pape.

Similar Threads

  1. Upload file as form post data
    By nareh tank in forum Ext: Q&A
    Replies: 1
    Last Post: 27 Jul 2013, 4:33 AM
  2. Replies: 2
    Last Post: 5 Sep 2012, 1:52 AM
  3. Replies: 1
    Last Post: 17 Oct 2011, 11:04 PM
  4. Form Upload - input not in the POST
    By maquejp in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 2 Mar 2009, 4:04 AM
  5. Cant Reach Server
    By pdchapin in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 30 Oct 2008, 7:31 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •