I know how to create a form that browses and selects a file, that’s not my question. What I need is to get the content of the selected file, to send it to a server and proccess it. For now I only can get the file location.
I think it will be better if I get my file on client side (extjs), then send it to server, but I have no idea how to do this.
{
xtype: 'fileuploadfield',
hideLabel: true,
emptyText: 'Select a file to upload...',
id: 'upfile',
//name:'file',
width: 220
},
buttons:
[
{
text: 'Upload',
handler: function () {
obj.Import(Ext.getCmp('upfile').getValue())
}
}
]
Import(...) is my server function. I need to give it the file not only its path!!
Thank you in advance for your time
What you are doing
Ext.getCmp('upfile').getValue()is clearly passing the file location to Import method. How do you expect the file content then? In order to upload a file, you need to submit a ExtJS form. You can do something like this:And on server side:
Update: You need to uncomment the name property of your
fileuploadfield.