public function deleteFile($name = null)
    {
        foreach ($this->getAllFields() as $field) {
            $path = $this->getFilePath($field, $name);
            if (!$path || !is_file($path) || !file_exists($path)) {
                continue;
            }
            unlink($path);
        }
        if ($name == $this->owner->getAttribute($this->fileField)
           && ($files = $this->getFileList())     
        ) {
            $this->owner->updateAttributes([$this->fileField => reset($files)]);
        }
        return true;
    }
public function deleteFile($name = null)
    {
        foreach ($this->getAllFields() as $field) {
            $path = $this->getFilePath($field, $name);
            if (!$path || !is_file($path) || !file_exists($path)) {
                continue;
            }
            unlink($path);
        }
        if ($name == $this->owner->getAttribute($this->fileField)
           && ($files = $this->getFileList())     
        ) {
            $this->owner->updateAttributes([$this->fileField => reset($files)]);
        }
        return true;
    }
public function deleteFile ( $ name = null ) { foreach ( $ this -> getAllFields ( ) as $ field ) { $ path = $ this -> getFilePath ( $ field , $ name ) ; if ( ! $ path || ! is_file ( $ path ) || ! file_exists ( $ path ) ) { continue ; } unlink ( $ path ) ; } if ( $ name == $ this -> owner -> getAttribute ( $ this -> fileField ) && ( $ files = $ this -> getFileList ( ) ) ) { $ this -> owner -> updateAttributes ( [ $ this -> fileField => reset ( $ files ) ] ) ; } return true ; }
Deletes file and all thumbnails by name
@param null $name
@return bool
Deletes file and all thumbnails by name