Scanning file uploads for viruses is a time honored tradition. We all know why it’s a good idea but sometimes it’s not easy to do. If you use Zend Framework, we’ve got good new for you. Matthew Setter has put together a tutorial on how to build a validator to help you scan them automatically. Here’s a taste of what you’ll get from Matthew’s article titled “ClamAV as a Validation Filter in Zend Framework”
Ok, so you’re pretty comfortable with using the Zend Framework, specifically the use of Forms. Along with that, you have a good working knowledge of how to combine a host of standard validators such as CreditCard, EmailAddress, Db_RecordExists, and Hex, and standard filters such as Compress/Decompress, BaseName, Encrypt, and RealPath. But what do you do when a situation arises that’s outside the scope of the pre-packaged validators and filters?
Let’s say you want to guard against users uploading files that contain viruses, for example. You would have to write a custom validator that checks the uploads aren’t infected. Today I’ll show you how to do just that – how to write a new file validation filter for Zend Framework that uses ClamAV to ensure uploaded files are virus-free.
It’s not a beginner level tutorial but it is well written and a great explanation of how to built a custom validator.