Exemplo n.º 1
0
 /**
  * Change our filename to match our own naming convention
  * @return bool
  */
 public function beforeValidate()
 {
     //(optional) Generate a random name for our file to work on preventing
     // malicious users from determining / deleting other users' files
     if ($this->secureFileNames) {
         //$this->filename = sha1( Yii::app( )->user->id.microtime( ).$this->name);
         $this->filename = sha1(Yii::$app->user->id . microtime() . $this->image_name);
         $this->filename .= "." . $this->file->getExtensionName();
     }
     return parent::beforeValidate();
 }