i want download my pdf file where he's saved in my phpmyadmin 'blob'
i try this code:
public function downloadAction()
{
$ma_base_de_donne = new myprojectdbEntity();
$item = $this->getDoctrine()->getRepository('myprojectBundle:myprojectdbEntity')->find(5);
if (!$item) {
throw $this->createNotFoundException("File with ID 5 does not exist!");
}
$pdfFile = $item->getFichier(); //returns pdf file stored as mysql blob
//$headers = array('Content-Type' => 'application/pdf', 'Content-Disposition' => "attachment; filename=" . urlencode($pdfFile));
$response = new Response($pdfFile, 200, array('Content-Type' => 'application/pdf'));
//return $response;
var_dump($response); die();
}
and i get this error :
The Response content must be a string or object implementing __toString(), "resource" given.
help me please
thanks first