PDA

View Full Version : Doubt for save the FileUploadField



chuvinha
30 Dec 2010, 11:07 AM
Hi guys, I need to pass o file selected from user for my action.
I am using java language and I have one object File.
I tried to use getValue(), but it wasn't work.




Ext.getCmp('btnSalvarProdutoArquivo').setHandler(
function(){
conn.request({
url: 'arquivo!save.action',
params: {
'arquivoPDF': Ext.getCmp('campoArquivoUpload').getValue()
},
success: successCRUDProdutoArquivo,
failure: failureCRUDArquivo
});

Ext.getCmp('popupProdutoArquivos').el.fadeIn().frame('#99BBE8');
});


Does anyone know how to do this?

skirtle
30 Dec 2010, 1:24 PM
Are you trying to upload the file or do you just want the filename/path? I'll assume the former.

File uploads are difficult. You have to use an HTML form and there's only so much Ext can do to abstract away the details. I suggest you dig out a tutorial on how to do file uploads with forms before trying to do them using Ext. Once you understand the limitations of what can be done in a web browser it'll make the Ext approach easier to understand.

Then try reading the Ext docs for Ext.form.BasicForm as well as the isUpload parameter of Ext.Ajax.request().

chuvinha
3 Jan 2011, 5:20 AM
I am trying to upload the file.
I read the loiane's tutorial about fileUpload and I tested in my application, but it wasn't work.




Ext.getCmp('btnSalvarProdutoArquivo').setHandler(
function(){
Ext.getCmp('arquivoForm').getForm().submit({
url: 'fazerUploadDeImagem.action'
});
});


It isn't get my action.
What am I doing wrong?

chuvinha
3 Jan 2011, 8:52 AM
It was work, but I still have a problem.
When I add params, it wasn't work more.



Ext.getCmp('btnSalvarProdutoArquivo').setHandler(
function(){
Ext.getCmp('arquivoForm').getForm().submit({
url: 'arquivo!save.action',
waitMsg: 'Importando sua(s) foto(s)...',
params: {
'idProduto': Ext.getCmp('campoIdProduto').getValue()
},
success: successCRUDProdutoArquivo,
failure: failureCRUDArquivo
});

Ext.getCmp('popupProdutoArquivos').el.fadeIn().frame('#99BBE8');
});


missing ) in parenthetical

(<h1>HTTP Status 500 - </h1><hr noshad...lfilling this request.</u></p><p><b>ex ext-all.js (linha 7)

Could someone help me?

chuvinha
3 Jan 2011, 9:41 AM
It was work now.
I passed the form for my action.
So I just put the name the fields with the same name from action.
And for the comboBox I put the id equal.
Thanks skirtle =))