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 - Content-Disposition for the data.  Options are:
      • inline (default) - indicates the file should display in the web browser if possible.
      • attachment - indicates the file should download.
    • 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
]);