What is the preferred way to add a profile image to a Symfony 1.4
Doctrine Project? I tried to do this myself and via searching the
forum. This would seem to be a basic function that isn't supported
out of the the box and for which isn't a clear example/tutorial. Am I
missing something?
I have tried to add a field called profile_image to the
sfGuardUserProfile object (and sfWidgetFormInputFileEditable form
element) to both the sfDoctrineApplyPlugin and the
sfForkedDoctrineApplyPlug but get the same error:
Error: This form is multipart, which means you need to supply a files
array as the bind() method second argument.
schema.yml
...
sfGuardUserProfile:
tableName: sf_guard_user_profile
columns:
id:
type: integer(4)
primary: true
autoincrement: true
user_id:
type: integer(4)
notnull: true
email:
type: string(80)
validate:
type: string(17)
profile_image:
type: string(1024)
relations:
User:
class: sfGuardUser
foreign: id
local: user_id
type: one
onDelete: cascade
foreignType: one
foreignAlias: Profile
====
form class
...
class sfGuardUserProfileForm extends BasesfGuardUserProfileForm
{
public function configure()
{
$this->widgetSchema['profile_image'] = new
sfWidgetFormInputFileEditable(array(
'label' => 'Profile Image',
'file_src' => '/uploads/profile-images/'.$this->getObject()-
>getProfileImage(),
'is_image' => true,
'edit_mode' => !$this->isNew(),
'template' => '<div>%file%<br />%input%<br />%delete%
%delete_label%</div>',
));
$this->validatorSchema['profile_image'] = new
sfValidatorFile(array(
'required' => false,
'path' => sfConfig::get('sf_upload_dir').'/profile-
images/',
'mime_types' => 'web_images',
));
}
}
--
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 [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