I would imagine if you are getting an empty file you a referencing the file incorrectly. Try echo out your path and make sure its correct.
make sure On Jul 24, 5:39 pm, Vijay Kumbhar <[email protected]> wrote: > i have removed that array too. but it is not still giving the file to > download. > > > > On Fri, Jul 24, 2009 at 8:06 AM, brian <[email protected]> wrote: > > > mimeType should be a string, not an array. Why do you assign it as > > array($result['Application']['type'])? > > > On Thu, Jul 23, 2009 at 2:23 PM, Vijay Kumbhar<[email protected]> wrote: > > > Hello Brian, > > > > Thanks for your reply.I have done as you told it gave me the $param > > values. > > > But it is not giving me download window :( . > > > > here is code as you told to comment the part, > > > > //Configure::write('debug', 0); > > > > $this->view = 'Media'; > > > > /* MediaView is really irritating > > > */ > > > //$name = $result['Application']['resume']; > > > > $ext = explode("." ,$result['Application']['resume']); > > > > $params = array( > > > 'name' => $ext[0], > > > 'download' => true, > > > 'extension' => $ext[1], > > > 'path' => APP."webroot/uploads".DS, > > > 'mimeType' => array($result['Application']['type']) > > > ); > > > > $this->set($params); > > > > die(debug($params)); > > > > And the output is as follows, > > > > app/controllers/applications_controller.php (line 198) > > > > Array > > > ( > > > [name] => resume-1 > > > [download] => 1 > > > [extension] => doc > > > [path] => MY_SERVER_DOCUMENT_PATH/app/webroot/uploads/ > > > [mimeType] => Array > > > ( > > > > [0] => application/msword > > > ) > > > > ) > > > > Please help. > > > > On Thu, Jul 23, 2009 at 10:15 PM, brian <[email protected]> wrote: > > > >> I like how you left my snarky comment in the code I'd posted :-) > > > >> Try commenting out the Configure::write('debug', 0) and, after you've > > >> set the $params array, put: > > > >> die(debug($params)); > > > >> ... so that you can see if the values are all what you're expecting. > > > >> Of course, you should also ensure that the file is where you think it > > >> is and that the permissions allow the server to read it. > > > >> On Thu, Jul 23, 2009 at 10:44 AM, Vijay<[email protected]> wrote: > > > >> > Hello All, > > > >> > I uploads the files to webroot/uploads folder from the file uploading > > >> > component. > > > >> > Now I am trying to download that file from webroot/uploads folder but > > >> > it is giving me 0 byte file. > > > >> > Code is as follows, > > > >> > function admin_download($id) > > >> > { > > >> > $this->adminchecksession(); > > >> > // you'll want to check the login status here ... > > > >> > $result = $this->Application->findById($id); > > > >> > Configure::write('debug', 0); > > >> > $this->view = 'Media'; > > > >> > /* MediaView is really irritating > > >> > */ > > >> > //$name = $result['Application']['resume']; > > > >> > $ext = explode("." ,$result['Application']['resume']); > > > >> > $params = array( > > >> > 'name' => $ext[0], > > >> > 'download' => true, > > >> > 'extension' => $ext[1], > > >> > 'path' => APP."webroot/uploads".DS, > > >> > 'mimeType' => array($result['Application'] > > >> > ['type']) > > >> > ); > > > >> > $this->set($params); > > > >> > } > > > >> > Please help me on this. > > > > -- > > > Thanks & Regards, > > > Vijayk. > > > Co-founder (www.weboniselab.com) > > > > "You Bring the Dreams, We'll Bring the Means" > > -- > Thanks & Regards, > Vijayk. > Co-founder (www.weboniselab.com) > > "You Bring the Dreams, We'll Bring the Means" --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
