Hi,
i have a problem. I'm using this tutorial
http://www.symfony-project.org/forms/1_1/en/02-Form-Validation to file
upload, but it gives me this error:
Fatal error: Call to a member function getOriginalName() on a non-
object in C:\sfyproject\apps\frontend\modules\people\actions
\actions.class.php on line 47

why??

my action class is:

public function executeCreate(sfWebRequest $request)
  {
        $this->forward404Unless($request->isMethod('post'));



    $this->form = new PersonaForm();
        if ($request->isMethod('post'))
    {
                $this->persona = Doctrine::getTable('Persona')->find($request-
>getParameter('id_persona'), $request->getFiles('people'));
        }

        if ($this->form->isValid())
        {
          $file = $this->form->getValue('foto');

          $filename = 'uploaded_'.sha1($file->getOriginalName());
          $extension = $file->getExtension($file->getOriginalExtension());
          $file->save(sfConfig::get('sf_upload_dir').'/'.$filename.
$extension);
        }

        $this->processForm($request, $this->form);
    $this->setTemplate('new');
  }


and my personaForm is:

class PersonaForm extends BasePersonaForm
{
  public function configure()
  {
        $this->setWidgets(array(
      'id_Persona'      => new sfWidgetFormInputHidden(),
      'id_account'      => new sfWidgetFormInputHidden(),
      'nome'            => new sfWidgetFormInput(),
      'cognome'         => new sfWidgetFormInput(),
      'data_di_nascita' => new sfWidgetFormDate(),
      'email'           => new sfWidgetFormInput(),
      'codice_fiscale'  => new sfWidgetFormInput(),
      'telefono'        => new sfWidgetFormInput(),
      'cellulare'       => new sfWidgetFormInput(),
      'foto'            => new sfWidgetFormInputFile(),
      'facebook'        => new sfWidgetFormInput(),
      'twitter'         => new sfWidgetFormInput(),
      'skype'           => new sfWidgetFormInput(),
      'linkedin'        => new sfWidgetFormInput(),
    ));

    $this->setValidators(array(
      'id_Persona'      => new sfValidatorDoctrineChoice(array('model'
=> 'Persona', 'column' => 'id_persona', 'required' => false)),
      'id_account'      => new sfValidatorInteger(array('required' =>
false)),
      'nome'            => new sfValidatorString(array('max_length' =>
255, 'required' => false)),
      'cognome'         => new sfValidatorString(array('max_length' =>
255, 'required' => false)),
      'data_di_nascita' => new sfValidatorDate(array('required' =>
false)),
      'email'           => new sfValidatorString(array('max_length' =>
255, 'required' => false)),
      'codice_fiscale'  => new sfValidatorString(array('max_length' =>
255, 'required' => false)),
      'telefono'        => new sfValidatorString(array('max_length' =>
20, 'required' => false)),
      'cellulare'       => new sfValidatorString(array('max_length' =>
15, 'required' => false)),
      'foto'            => new sfValidatorFile(),
      'facebook'        => new sfValidatorString(array('max_length' =>
255, 'required' => false)),
      'twitter'         => new sfValidatorString(array('max_length' =>
255, 'required' => false)),
      'skype'           => new sfValidatorString(array('max_length' =>
255, 'required' => false)),
      'linkedin'        => new sfValidatorString(array('max_length' =>
255, 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('persona[%s]');
  }
}

where is the problem??

thanks

-- 
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-us...@googlegroups.com.
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en.

Reply via email to