method download documentation in bbn\File

Downloads the file. At the end of the script the user will be invited to choose the file's destination. If the file doesn't exist return an object with parameter file = null.

Example

$f = new \bbn\File('C:/Test/file.png'); $f->download(); function() { if ($this->file) { if (!$this->size) { $this->getSize(); } if (!$this->size) { throw new Exception(X::_("Impossible to get the file %s", $this->file)); } while (@ob_end_flush()); header("Content-Encoding: none"); ignore_user_abort(true); ini_set('output_buffering', 'Off'); ini_set('zlib.output_compression', false); header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="' . Str::escapeDquotes(basename($this->name)) . '"'); header('Expires: 0'); header('Cache-Control: must-revalidate'); header('Pragma: public'); header('Content-Length: ' . $this->size); readfile($this->file); exit; } }

Downloads the file. At the end of the script the user will be invited to choose the file's destination. If the file doesn't exist return an object with parameter file = null. BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way

This website uses cookies to ensure you get the best experience on our website.