/** * @param Application $app * @param $file * @return \Symfony\Component\HttpFoundation\BinaryFileResponse|void */ public function getUserFile(Application $app, $file) { try { $file = $app['chamilo.filesystem']->get('upload/users/' . $file); return $app->sendFile($file->getPathname()); } catch (\InvalidArgumentException $e) { return $app->abort(404, 'File not found'); } }