CI_Zip::read_file PHP Method

read_file() public method

Read the contents of a file and add it to the zip
public read_file ( string $path, boolean $archive_filepath = FALSE ) : boolean
$path string
$archive_filepath boolean
return boolean
    public function read_file($path, $archive_filepath = FALSE)
    {
        if (file_exists($path) && FALSE !== ($data = file_get_contents($path))) {
            if (is_string($archive_filepath)) {
                $name = str_replace('\\', '/', $archive_filepath);
            } else {
                $name = str_replace('\\', '/', $path);
                if ($archive_filepath === FALSE) {
                    $name = preg_replace('|.*/(.+)|', '\\1', $name);
                }
            }
            $this->add_data($name, $data);
            return TRUE;
        }
        return FALSE;
    }