开发者

Zend_File_Transfer_Adapter_Http Extension Validator

开发者 https://www.devze.com 2023-01-16 08:16 出处:网络
I have 开发者_如何转开发the next code: $currFile = new Zend_File_Transfer_Adapter_Http(); $currFile->addValidator(\'Extension\', false, \'jpg\');

I have 开发者_如何转开发the next code:

$currFile = new Zend_File_Transfer_Adapter_Http();
$currFile->addValidator('Extension', false, 'jpg');

It works pretty. But if I put array('jpg','png') instead of 'jpg', only files with jpg extendion works.

How can I set more than 1 extension. Thank you for your help.


Here is an example of Pekka's suggestion:

$currFile->addValidator('Extension', false, 'png,jpg')

As Pekka said, if you have not tried it, try the , separated list. But given that only jpg files work, even if you add the array or comma separated list I would make sure you are modifying the correct file. To test this, remove the jpg all together and just use png and see if that validates alone. If not then chances are you are modifying the wrong file. As for you "not using Zend_File_Transfer" the adapter you are using is an extension of it, so it has access to the same items / features so the Documentation Pekka linked to is relevant.


You have to specify if the extensions are allowed or denied

$currFile->addValidator('Extension', false, array('extension1' => 'png,jpg', 'case' => true))

You can take a look in the Zend documentation

http://framework.zend.com/manual/en/migration.17.html

0

精彩评论

暂无评论...
验证码 换一张
取 消