ClamAV as a Validation Filter in Zend Framework

Matthew Set­ter writes a very inter­est­ing arti­cle; Ok, so you’re pretty com­fort­able with using the Zend Frame­work, specif­i­cally the use of Forms. Along with that, you have a good work­ing knowl­edge of how to com­bine a host of stan­dard val­ida­tors such as Cred­it­CardEmailAd­dressDb_RecordExists, and Hex, and stan­dard fil­terssuch as Compress/DecompressBase­NameEncrypt, and Real­Path. But what do you do when a sit­u­a­tion arises that’s out­side the scope of the pre-packaged val­ida­tors and filters?

Let’s say you want to guard against users upload­ing files that con­tain viruses, for exam­ple. You would have to write a cus­tom val­ida­tor that checks the uploads aren’t infected. Today I’ll show you how to do just that – how to write a new file val­i­da­tion fil­ter for Zend Frame­work that uses Cla­mAVto ensure uploaded files are virus-free.

Adding Cla­mAV Sup­port to PHP

First you’ll need to install Cla­mAV sup­port. I’m bas­ing this instal­la­tion pro­ce­dure around Linux, specif­i­cally Ubuntu. If you’re using another dis­tri­b­u­tion, you may need to adjust the com­mands accord­ingly. Unfor­tu­nately, if you’re using Win­dows how­ever, you’ll need to use a Linux-based Vir­tual Appli­ance or setup a vir­tual machine run­ning Linux to fol­low along since the php-clamav exten­sion doesn’t sup­port Win­dows as yet.

Full Story with Source » php­mas­ter.

Tags: , , ,

Leave a Comment

*

Get Adobe Flash playerPlugin by wpburn.com wordpress themes