[ pecooou @ 01.07.2014. 09:21 ] @
Kada downloadujem PDF prikazuje da je dokument corrupted. Evo koda iz PagesController: Code: public function download($filename = null) { // Check if a filename was specified if (is_null($filename)) { $this->Session->setFlash('Sorry, no file was specified for download.'); $this->redirect($this->referer()); } $this->viewClass = 'Media'; // Split the filename into it's constituent parts, i.e. the name and the extension $pathinfo = pathinfo($filename); $params = array( 'id' => $filename, 'name' => $pathinfo['filename'], 'extension' => $pathinfo['extension'], 'path' => 'downloads' . DS, 'download' => true, 'mimeType' => $this->__getMimeType($pathinfo['extension']) ); $this->set($params); } /** * __getMimeType function. * * @access private * @param mixed $extension * @return void */ private function __getMimeType($extension) { switch ($extension) { case "pdf": return "application/pdf"; break; } } Ako bi neko mogao da pomogne, puno bi mi znacilo. P.S. Verzija Cakea je 2.3. |