Yii 1.1: file-upload-error-validator

Validates PHP error status for an uploaded file
1 follower

Note: This validator is redundant with CFileValidator, which already does the upload validations. Sorry.

(Note to self: Must read the core code more closely).

This validator will check the PHP upload status of a file and will throw the errors to the attribute.

Requirements

Created and tested with Yii 1.1.9

Usage

Download, unzip and copy the file. Example, into protected/extensions/validators

In your model, add the rule as follows.

public function rules() {
    return array(
        ...
        array('xmlFile', 'file', 'allowEmpty' => false, 'types' => 'xml'),        
        array('xmlFile', 'ext.validators.fileUploadErrorValidator'),
        ...
    );
  }

Be the first person to leave a comment

Please to leave your comment.

Create extension