already got this too, we need to create a ticket for it.It is a bit random,
sometimes changing the order of the embeded forms fix it. REALLY weird.

there's this workdaround too
http://stereointeractive.com/blog/2008/12/23/symfony-12-upload-a-file-inside-an-embedded-form/

On Fri, Jun 12, 2009 at 03:49, dagger <strategy.vs.lo...@gmail.com> wrote:

>
> Hi,
>
> Concept: I have made 2 tables - images and resort - each resort has a
> logo and can have many pictures - but for this application  idecided
> that each resort would have 4 images.
>
> Problem: in the earlier version of symfony all was well. But then i
> upgraded to symfony 1.2.7 - and after that it stopped working - the
> code is given below - i tried 2 solutions - one was to make 2 form
> objects - ResortForm and UploadForm - UploadForm is the form
> containing the 4 image fields and in the update action of the resort
> controller i populate the image table. it didn't work - u can see as i
> have commented it out - then i simply used input_file_tag which u can
> see below as well... but no matter wat the $file just remains to be
> NULL - Note that the logo of resort is uploaded properly coz its part
> of ResorfForm but not the other files :(
>
> $this->form->bind($request->getParameter('resort'), $this->getRequest
> ()->getFiles('resort'));
>
>    if($this->getRequest()->getParameter('refresh') != 'Y')
>    {
>
>            if ($this->form->isValid())
>            {
>                $resort = $this->form->save();
>
>                $file = $this->form->getValue('logo');
>
>                if($file){
>                            $filename =
> 'upload_'.sha1($file->getOriginalName());
>                            $extension =
> $file->getExtension($file->getOriginalExtension
> ());
>
>  $file->save(sfConfig::get('sf_upload_dir').'/'.$filename.
> $extension);
>
>                            $resort->setLogo($filename.$extension);
>                             $this->createLogo($filename.$extension,
> sfConfig::get
> ('sf_upload_dir').'/');
>                             $this->createThumbnail($filename.$extension,
> sfConfig::get
> ('sf_upload_dir').'/');
>                }
>              $resort->save();
>
>              //$this->imgFile = new UploadForm();
>
>              //$this->imgFile->bind($this->getRequest()->getParameter
> ('upload'), $this->getRequest()->getFiles('upload'));
>
>                  for($i = 1; $i <= 4; $i++)
>                      {
>                        $file =
> $this->getRequest()->getFiles('image_'.$i);//$this-
> >form->getValue('image_'.$i);
>
>                        if($file){
>                                echo 'uploading image <br/>';
>                                $filename =
> 'upload_'.sha1($file->getOriginalName());
>                                        $extension =
> $file->getExtension($file->getOriginalExtension());
>
>  $file->save(sfConfig::get('sf_upload_dir').'/'.$filename.
> $extension);
>
>                                $image = new Image();
>
>                                $image->setResortId($resort->getId());
>                                $image->setPath($filename.$extension);
>
>                                $image->save();
>                                $this->createLargeImage($image->getPath(),
> sfConfig::get
> ('sf_upload_dir').'/');
>                        }
>                      }
>
>              $this->setTemplate('testimage');
>              return;
>            }
>    } else {
>        return $this->renderPartial('countrycity', array('form' => $this-
> >form));
>    }
>
>    //$this->imgFile = new UploadForm();
>    $this->setTemplate('edit');
>
> i understand that this is not the proper way of implementing it and as
> i am new to symfony i would appreciate if you people can help me get
> this to work. Thanks.
>
> >
>


-- 
Sidney G B Ferreira
Desenvolvedor Web

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@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