Quick links: Content - sections - sub sections
EN

Trace: coord crud main-concepts responsetcpdf coord xml-1.1 jforms responsebinary creer_response responsebinary

Wiki: Sitemap - Recent changes - Back link

To be able to send binary content (a graphic, a video, some sound, an archive, and so on), one should use jReponseBinary. In your action method, just get a 'binary' response:

$resp = $this->getResponse('binary');

then, you have to set $outputFileName property. $outputFileName will be the name shown to the user.

 $resp->outputFileName = 'truc.gif';

You can define the mime type of your content:

 $resp->mimeType = 'image/gif';

You have an option for files you want the user to download (particularly, files not rendered by common browsers). just set:

 $resp->doDownload = true;

For the content itself, you have to define either $filename or $content property.

If it is an existing file, just use $filename:

   $resp->fileName = JELIX_VAR_PATH.'fichier_a_renvoyer.gif';

Otherwise, if your content is generated or comes from your database, use $content:

   $resp->content = '...';
en/manual-1.0/responsebinary.txt · Last modified: 2008/11/19 16:02 (external edit)
Recent changes RSS feed Creative Commons License