简体   繁体   中英

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?

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.

items: [{
    xtype: 'filefield',
    name: 'file',
    fieldLabel: 'File',
    labelWidth: 50,
    anchor: '100%',
    buttonText: 'Select File...'
}],

Live demo is here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM