yes, you can
Example:
----- actions.class.php ------
if ($this->form->isValid()) {
$file = $this->form->getValue('photo');
$path = "/tmp/file.";
$extension = strtolower($file->getExtension($file-
>getOriginalExtension()));
$file->save($path.$extension);
}
--------
---- PhotoForm.class.php ------
class PhotoForm extends sfForm
{
public function configure()
{
$this->setWidgets(array(
'photo' => new
sfWidgetFormInputFile(),
));
$this->setValidators(array(
'photo' => new
sfValidatorFile(array('required' => true,
'max_size' => '1024000', // bytes (1MB)
'mime_types' => array('image/jpeg')
)),
));
$this->validatorSchema['photo']->setMessage('max_size', 'File size
limit is 1MB, please make your file smaller');
$this->validatorSchema['photo']->setMessage('mime_types', 'The
file you submit is not a valid format. Please upload a JPG, GIF or PNG
image file');
$this->validatorSchema['photo']->setMessage('required', 'Click
browse and choose one of your photos to apear on your profile');
$this->widgetSchema->setNameFormat('photoform[%s]');
$this->errorSchema = new sfValidatorErrorSchema($this-
>validatorSchema);
}
}
2008/5/7 Yohan 'rouKs' G. <[EMAIL PROTECTED]>:
>
> Hi all,
>
> I've got a problem with file upload in sf1.1. Validating alway miss
> with the message 'requested'.
>
> How can i upload files in 1.1 ?
>
> Thanks.
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---