Hello,

I seem to have a problem with uploading a profile picture and saving
it to a user's profile. What I've done is created a "img" column in
the sfGuardUserProfile table. The problem is when I save the form, all
values are stored except for "img", and the value is neither saved in
the database nor in the given folder.

Here is the Form:

class thisUserSettingsForm extends sfGuardUserProfileForm
{
  public function configure()
  {
    $this->widgetSchema['img'] = new sfWidgetFormInputFile();

    $this->validatorSchema['img'] = new sfValidatorFile(array(
      'required' => false, 'mime_types' => 'web_images',
      'path' => sfConfig::get('sf_upload_dir')
    ));
  }
}

And the action:

  public function executeSettings(sfWebRequest $request)
  {
    $profile = $this->getUser()->getProfile();
    $this->form = $this->newForm('sfApplySettingsForm', $profile);
    if ($request->isMethod('post')) {
      $this->form->bind($request->getParameter($this->form-
>getName()), $request->getFiles($this->form->getName()));
      if ($this->form->isValid())
      {
        $this->form->save();
      }
    }
  }

I've heard about some problems regarding merged forms, such as in this
forum discussion: http://forum.symfony-project.org/index.php/m/92591/

Does anybody know how I let a user upload an avatar picture? This
seems to be such a common feature that I'm surprised it doesn't
work...


-- 
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