/** * Returns the url to the file. * * @return string */ public function url() { $protocol = $this->protocol(); if ($protocol == 'http' || $protocol == 'https' || $protocol == 'ftp') { return $this->path; } elseif ($protocol != '') { throw new Exception("Unable to get URL to file '{$this->_path}'. The {$protocol} protocol is not supported in browsers."); } return $this->withRootAs(Fs::document_root()); }