Alex Pliutau
Alex Pliutau

Reputation: 21957

Zend_File_Transfer_Adapter_Http Extension Validator

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.

Upvotes: 0

Views: 3152

Answers (2)

Sebastiano
Sebastiano

Reputation: 11

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

Upvotes: 1

Jim
Jim

Reputation: 18853

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.

Upvotes: 2

Related Questions