I'm struggling with the following problem:
I'm using symfony 1.4.6 and have followed the "The more with symfony"
book, chapter "Advanced forms" by Ryan Weaver, Fabien Potencier.
[url]http://www.symfony-project.org/more-with-symfony/1_4/en/06-
Advanced-Forms[/url]

Everything works fine and the photos are uploaded and the filename is
stored in the database.
But now I want the use the OriginalName() and the sfThumbnailPlugin to
make thumbnails of the photos and to store the original filename.
I thought to include this code in the saveEmbeddedForms function of
the ProductForm.

[code]public function saveEmbeddedForms($con = null, $forms = null)
{
  if (null === $forms)
  {
    $photos = $this->getValue('newPhotos');
    $forms = $this->embeddedForms;

    $file = $photos['filename'];
    $filename = $file->getOriginalName();
    $file->save(sfConfig::get('sf_upload_dir').'/'.$filename);

    foreach ($this->embeddedForms['newPhotos'] as $name => $form)
    {
      if (!isset($photos[$name]))
      {
        unset($forms['newPhotos'][$name]);
      }
    }
  }

  return parent::saveEmbeddedForms($con, $forms);
}
[/code]

But with this code the file is uploaded twice. Once with the hashed
name and once with the original name. In the database it is stored
with the hashed filename.
I can not find where the file is saved with the hashed name. Also
placing this code in the actions ProcessForm gives the same result.

Can somebody help me out?

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

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