public function executeShow() { $this->setLayout(false); $c = new Criteria(); $c->add(PhotosPeer::PHOTO,$this->getRequestParameter('photo')); $photo = PhotosPeer::doSelectOne($c); // Check if the person requesting the image actually owns the image if($this->getUser()->getAttribute('ultn') != $photo->getUltn()) { $this->foward404(); } // They do, send the file $imageName = $this->getRequestParameter('photo'); $fileToSend = "idPhotos/pending/original/".$imageName; // Format the file to send $this->getResponse()->setHttpHeader('Content-Type','image/jpg'); $this->getResponse()->setHttpHeader('Content-Disposition', 'attachment; filename="'.$imageName.'"'); $this->getResponse()->setContent(@readfile($fileToSend)); $this->getResponse()->sendHttpHeaders(); $this->getResponse()->sendContent(); return sfView::NONE; }