Передача содержимого файла из Extjs в переполнение стека

Я ищу способ передать часть содержимого из Extjs в php для обработки, но он не работает. Это то, что я пробовал до сих пор:

Ext.onReady(function(){
Ext.create('Ext.form.Panel', {
title: 'Upload a PDF File',
width: 400,
bodyPadding: 10,
frame: true,
renderTo: 'uploadForm2',
items: [
{
xtype: 'filefield',
name: 'file',
fieldLabel: 'PDF File',
labelWidth: 50,
msgTarget: 'side',
allowBlank: false,
anchor: '100%',
buttonText: 'Select File...',
id: 'file'
},
{
xtype: 'button',
text: 'Upload',
handler: function(){
var file = Ext.getCmp('file').getEl().down('input[type=file]').dom.files[0];
var form = this.up('form');
form.saveFile(file);
}
}
],

saveFile: function(file){
var newFile = file; // this file how can i send it to codeigniter?
console.log(newFile);
}
})
});

0

Решение

Вам должно быть лучше с form.submit. Не уверен, какую версию ext вы используете, но в основном она такая же.

form.submit({
url:'url for upload',
method: 'POST',
success: function(fp, o){
// your logic after successful upload
},
failure: function(fp, o){
// handle failures
}
});
0

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector