webCOMAND

view::send_data()

Send file data to the browser.

Prototype

string send_data(string $data, array $options = [])

Parameters

  • data - String of data to send as a file.
  • options - Optional associative array of one or more of the following options.
    • filename - Filename for the data.
    • disposition - Download disposition for the data.
    • mimetype - Mime-Type to send as the Content-Type.  If not specified, it will be automatically determined from the data.

Example

$image = $repo->get('SELECT Filename, Data FROM Image WHERE OID=123']);
\io_comand_mvc\view::send_data($image->Data, [
    'filename'=>$image->Filename
]);

Related