Quick links: Content - sections - sub sections
EN FR

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 = '...';