Files::delFile PHP Method

delFile() public method

Delete a file.
public delFile ( string $file ) : boolean
$file string file to be deleted
return boolean true if deleted, false otherwise.
    function delFile($file)
    {
        if (is_file($file)) {
            return unlink($file);
        } else {
            return false;
        }
    }

Usage Example

 /**
  * Delete the relative file, and any thumbnails.
  * @param string $relative the relative file.
  * @return boolean true if deleted, false otherwise.
  */
 function _delFile($relative)
 {
     $fullpath = Files::makeFile($this->getImagesDir(), $relative);
     //check that the file is an image
     if ($this->config['validate_images'] == true) {
         if (!is_array($this->getImageInfo($fullpath))) {
             return false;
         }
         //hmmm not an Image!!???
     }
     $thumbnail = $this->getThumbName($fullpath);
     if (Files::delFile($fullpath)) {
         return Files::delFile($thumbnail);
     } else {
         return false;
     }
 }
All Usage Examples Of Files::delFile