Hi, I resolved this problem and decided to report this problem here:
http://trac.symfony-project.org/ticket/6605
"...
I have two forms in a template (formA and formB) with a single submit
button. The formA has is a classic file upload form.
In the action, if I do this (bind first formA and then formB):
$formA->bind(
$request->getParameter($formA->getName()),
$request->getFiles($formA->getName());
$formB->bind(
$request->getParameter($formB->getName()),
$request->getFiles($formB->getName());
It works perfectly, but if I bind first formB and then formA, I get
$formA->isValid() === false, and if I do:
echo $this->formA->getValue('file')->getOriginalName();
I get a Fatal error: Call to a member function getOriginalName() on a
non-object
..."
I hope it helps somebody... bye!
On 8 jun, 22:46, "Gustavo G." <[email protected]> wrote:
> Hi there!
> I've been all the day with the same problem! Please help!
> I have this form:
>
> class PersonaBatchForm extends sfForm
> {
> public function configure()
> {
>
> $this->widgetSchema['csv_file'] = new sfWidgetFormInputFile(array(
> 'label' => 'Ingrese su archivo csv'
> ));
>
> $this->widgetSchema['codificacion'] = new sfWidgetFormChoice(array
> (
> 'choices' => array('utf-8' => 'UTF-8', 'latin-1' => 'Latin-1'),
> 'expanded' => true
> ));
>
> $this->widgetSchema['loaded_filename'] = new
> sfWidgetFormInputHidden();
>
> $this->validatorSchema['csv_file'] = new sfValidatorFile(array(
> 'required' => false,
> 'path' => sfConfig::get('sf_upload_dir').'/batch',
> 'mime_types' => 'text/plain',
> ));
>
> $this->validatorSchema['codificacion'] = new sfValidatorChoice(array(
> 'required' => true, 'choices' => array('utf-8','latin-1')
> ));
>
> $this->validatorSchema->setOption('allow_extra_fields', true);
> $this->widgetSchema->setNameFormat('batch[%s]');
> }
>
> }
>
> And in the action, if I print the request, I get everything but the
> 'csv_file'. My <form> has the enctype="multipart/form-data" attribute.
>
> The rare thing is that if I remove that enctype attribute from my
> <form>, I receive the 'csv_file' parameter, but like a string (because
> the browser doesn't upload it, of course)
>
> I wonder if any of you have had the same problem...
>
> Thank you!
>
> ps: Sorry for my english!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---