Use this extension to validate if an uploaded file is a XML file.
It will try to open the file with SimpleXML and if it fails it will set the libxml errors to the attribute.
Requirements ¶
Created and tested with Yii 1.1.9
Usage ¶
Copy the attached file to the extensions folder (Example: protected/extensions/validators).
In your model, add something like this:
public function rules() {
return array(
...
array('xmlFile', 'file', 'allowEmpty' => false, 'types' => 'xml'),
array('xmlFile', 'ext.validators.isXmlValidator'),
...
);
}
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.