notexists This validator validates the absence of requested file.

  1. Requirements
  2. Installation and Usage

This validator validates the absence of requested file and optionally you can rename the $object->$attribute and save the file using the $object->$attribute.

  • Properties :
    1. string $path the path to look up
    2. boolean $renameIfExists can be used to rename the $object->$attribute if the file already exists. Defaults to true.
    3. boolean $allowEmpty can be used to set allow empty file upload. Defaults to true
    4. string $emptyMessage can be used to display error when file is empty
    5. string $existMessage can be used to display error when file already exists

Requirements

Yii 1.1

Installation and Usage

  1. Copy this validator to protected/extensions

  2. Inside rules() of your model use like this : array('file','ext.validator.NotExists','path'=>'images/','allowEmpty'=>false,'renameIfExists'=>false,'emptyMessage'=>'{attribute} is empty','existMessage'=>'{value} already exists'),

...you can use the validator like the following...

public function rules()
	{
		return array(
			....
			....        array('file','ext.validator.NotExists','path'=>'images/','allowEmpty'=>false,'renameIfExists'=>false,'emptyMessage'=>'{attribute} is empty','existMessage'=>'{value} already exists'),
			....
			....
		);
	}
0 0
2 followers
357 downloads
Yii Version: Unknown
License: BSD-2-Clause
Category: Validation
Developed by: Ahamed Rifaideen
Created on: Jul 17, 2013
Last updated: 4 years ago

Downloads

show all

Related Extensions