Hello, i am trying to build a file upload with sf 1.2 and doctrine. I
am following this tutorial :
http://www.symfony-project.org/forms/1_2/en/11-Doctrine-Integration#chapter_11_sub_handling_the_files_upload
( look for "file upload" ).

I have the following schema ( only 1 model ) :

StoredFile:
  columns:
    file:         string(255)
    name:         string(25

i build everything and then i modify the form class like so :

class StoredFileForm extends BaseStoredFileForm
{
  public function configure()
  {
    $this->widgetSchema['file'] = new sfWidgetFormInputFile();
    $this->validatorSchema['file'] = new sfValidatorFile();
  }
}

i then build a module which allso contains the show action and modify
the generated "processForm" method of the module like so :

  protected function processForm(sfWebRequest $request, sfForm $form)
  {
    $form->bind($request->getParameter($form->getName()),$request-
>getFiles($form->getName()));
    if ($form->isValid())
    {

      $file = $this->form->getValue('file');
      $filename = sha1($file->getOriginalName()).$file->getExtension
($file->getOriginalExtension());
      $file->save(sfConfig::get('sf_upload_dir').'/'.$filename);


      $stored_file = $form->save();

      $this->redirect('upload/show?id='.$stored_file->getId());
    }
  }


The problem :

After i upload my file and fill out the name i get this error :

----------------------------------------------------------------------------------
500 | Internal Server Error | Doctrine_Validator_Exception
Validation failed in class StoredFile

1 field had validation error:

* 1 validator failed on file (type)
-----------------------------------------------------------------------------------

... and i don't know what to make of it. Any help ?


P.S. i can allso provide the stack trace if necessary.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to