Pop\File\File::output PHP Method

output() public method

Output the file object directly.
public output ( boolean $download = false ) : File
$download boolean
return File
    public function output($download = false)
    {
        // Determine if the force download argument has been passed.
        $attach = $download ? 'attachment; ' : null;
        $headers = array('Content-type' => $this->mime, 'Content-disposition' => $attach . 'filename=' . $this->basename);
        $response = new \Pop\Http\Response(200, $headers, $this->read());
        if (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443) {
            $response->setSslHeaders();
        }
        $response->send();
        return $this;
    }

Usage Example

Example #1
0
 /**
  * Output the PDF directly to the browser.
  *
  * @param  boolean $download
  * @return void
  */
 public function output($download = false)
 {
     // Format and finalize the PDF.
     $this->finalize();
     parent::output($download);
 }
All Usage Examples Of Pop\File\File::output