Search code examples
javascriptfile-uploadextjs4

File upload ExtJS 4


I have this field:

{
    xtype: 'filefield',
    labelAlign: 'top',
    id: 'fileAllegato',
    hidden: true,
    margin: '0 15 5 10',
    fieldLabel: 'Allegato',
    allowBlank: false,
    blankText:'Il campo &egrave obbligatorio!',
    typeAhead: true,
    selectOnFocus: true,   
    anchor: '100%',
    buttonText: 'Allega'
}

When I load the file, I want to save it in db. The field does not belong to a form and, therefore, I can not do the submit. How can I do?


Solution

  • You can create a dummy form (without even displaying it). Something like

    var f = Ext.create('Ext.form.Panel', {
       items: [ your filefield item ]
    })
    

    And then do submit.