Hello...
i want to make validation on file upload that only xml file is upload other are not allowed...so how can i ...?
Thanks,
Gaurang
$this->validatorSchema['file'] = new sfValidatorFile(array(
'required' => true,
'path' => sfConfig::get('sf_upload_dir').'/robots',
'mime_type_guessers' => array('guessFromMimeContentType','guessFromFileinfo', 'guessFromFileBinary'),
'mime_types' => array('text/xml')
)
));Warning: call_user_func(guessFromMimeContentType) [function.call-user-func]: First argument is expected to be a valid callback in /MySymfonyProject/lib/vendor/symfony/lib/validator/sfValidatorFile.class.php on line 191
Warning: call_user_func(guessFromFileinfo) [function.call-user-func]: First argument is expected to be a valid callback in /MySymfonyProject/lib/vendor/symfony/lib/validator/sfValidatorFile.class.php on line 191
Warning: call_user_func(guessFromFileBinary) [function.call-user-func]: First argument is expected to be a valid callback in /MySymfonyProject/lib/vendor/symfony/lib/validator/sfValidatorFile.class.php on line 191
Warning: Cannot modify header information - headers already sent by (output started at /MySymfonyProject/lib/vendor/symfony/lib/validator/sfValidatorFile.class.php:191) in /MySymfonyProject/lib/vendor/symfony/lib/response/sfWebResponse.class.php on line 336
Warning: Cannot modify header information - headers already sent by (output started at /MySymfonyProject/lib/vendor/symfony/lib/validator/sfValidatorFile.class.php:191) in /MySymfonyProject/lib/vendor/symfony/lib/response/sfWebResponse.class.php on line 357
Symfony expects an array, so try this:
- Code: Select all
public function configure()
{
$this->validatorSchema['file'] = new sfValidatorFile(array(
'required' => true,
'path' => sfConfig::get('sf_upload_dir').'/robots',
'mime_types' => array('text/xml'),
));
Users browsing this forum: No registered users and 0 guests