PDA

View Full Version : Form Problem (FileUploadField undefined)



scaron
1 Jul 2010, 12:42 PM
Hi everyone,

I actually work on a form where I have a lot of FileUploadField component. I out the method to GET and I catch all of my parameters in another PHP page. But, I have a problem with the value of my input, it always return 'undefined'(only for the FileUploadField)

Just take a look (.JS)
var formMembre = new Ext.FormPanel({
labelWidth: 200,
items:
[{
xtype: "fieldset",
title: "Membre",
collapsible: true,
autoHeight:true,
defaults: {anchor: "28%", /*allowBlank: false*/},
items:
[{
xtype: "fileuploadfield",
fieldLabel: "Photo",
emptyText: "Sélectionner une photo",
name: "photoMembre"
}]

.........

buttons:
[{
text: "Accepter",
name: "btnEnvoyer",
handler: function()
{
var formValues = formMembre.getForm().getValues();
formMembre.getForm().submit({
url: "Bottin.php?photoMembre=" + formValues['photoMembre'] + "&categorie=" + formValues['categorie'] + "&nomEntreprise=" + formValues['nomEntreprise'] +
"&adresse=" + formValues['adresse'] + "&ville=" + formValues['ville'] + "&province=" + formValues['province'] + "&telephone=" + formValues['telephone'] +
"&telecopieur=" + formValues['telecopieur'] + "&courriel=" + formValues['courriel'] + "&lnkWebsite=" + formValues['lnkWebsite'] + "&lnkFacebook=" + formValues['lnkFacebook'] +
"&lnkTwitter=" + formValues['lnkTwitter'] + "&lnkYoutube=" + formValues['lnkYoutube'] + "&lnkFlickr=" + formValues['lnkFlickr'] + "&lnkAutres=" + formValues['lnkAutres'] +
"&img01=" + formValues['img01'] + "&img02=" + formValues['img02'] + "&img03=" + formValues['img03'] + "&img04=" + formValues['img04'] + "&img05=" +
formValues['img05'] + "&video01=" + formValues['video01'] + "&video02=" + formValues['video02'] + "&fichier01=" + formValues['fichier01'] +
"&fichier02=" + formValues['fichier02'],
method: "GET",
waitTitle : "En cours de traitement",
waitMsg: "Enregistrement en cours..."
})
}
},{
text: "Annuler",
handler: function()
{
formMembre.getForm().reset();
formWindowProg.hide();
}
}]

I catch the parameter in another page with
$name_of_element = $_GET["name_attribut"]

How can I fix this problem?
I really appreciate your help.
Thanks !!!

Animal
1 Jul 2010, 1:19 PM
You can't GET a file in Javascript!

How insecure would that be?

You have to submit the form as a fileUpload.

4 Jul 2010, 9:04 AM
You can only upload data via multi-form post/put methods.


Please post code within CODE tags in the future.

scaron
5 Jul 2010, 4:51 AM
Thank for your help but I stay with the same problem already, I can't get the value of the file upload field. I try to put fileUpload: true at the beginning of
myForm = new Ext.FormPanel({
fileUpload: true
method: "POST" // I put the same line in my button submit too
})

But Firebug give me a Syntax error () at line 7 of the file ext-all.js?

What is it suppose to mean, it seem that no one else on Web got this problem at this time. My version of ExtJs is up to date too so what do you think about that?

Thank you,
Sebastien

Animal
5 Jul 2010, 5:01 AM
First, read the debugging FAQ.