mongosoft\file\UploadBehavior::delete PHP Method

delete() protected method

Deletes old file.
protected delete ( string $attribute, boolean $old = false )
$attribute string
$old boolean
    protected function delete($attribute, $old = false)
    {
        $path = $this->getUploadPath($attribute, $old);
        if (is_file($path)) {
            unlink($path);
        }
    }

Usage Example

コード例 #1
0
 /**
  * @inheritdoc
  */
 protected function delete($attribute, $old = false)
 {
     parent::delete($attribute, $old);
     $profiles = array_keys($this->thumbs);
     foreach ($profiles as $profile) {
         $path = $this->getThumbUploadPath($attribute, $profile, $old);
         if (is_file($path)) {
             unlink($path);
         }
     }
 }