Try putting Configure::write('debug', 0); in top of your action.

On Oct 19, 7:38 am, "marek. bytnar" <[EMAIL PROTECTED]> wrote:
> Cake puts some characters which destroy .doc structure when
> downloading. Here is an analogic function which works ok in plain php
> script
>
> function download_doc_file($id = null)
> {
>         $this->autoRender = false;
>         $file = APP."rtf/".$id."/cv.doc";
>
>         $basename = basename($file);
>
>         $file_extension = strtolower(substr(strrchr($basename,"."),
> 1));
>
>         if (!file_exists($file))
>         {
>                 print "ERROR: File not found. $basename";
>                 exit;
>         }
>         else {
>                 switch($file_extension)
>                 {
>                         case "PLS": $ctype="audio/x-scpls"; break;
>                         case "pls": $ctype="audio/x-scpls"; break;
>                         case "pdf": $ctype="application/pdf"; break;
>                         case "exe": $ctype="application/octet-stream";
> break;
>                         case "zip": $ctype="application/zip"; break;
>                         case "doc": $ctype="application/msword";
> break;
>                         case "xls": $ctype="application/vnd.ms-excel";
> break;
>                         case "ppt": $ctype="application/vnd.ms-
> powerpoint";break;
>                         case "gif": $ctype="image/gif"; break;
>                         case "png": $ctype="image/png"; break;
>                         case "jpeg":
>                         case "jpg": $ctype="image/jpg"; break;
>                         default: $ctype="application/force-download";
>                 }
>                 header("Pragma: public");
>                 header("Expires: 0");
>                 header("Cache-Control: must-revalidate, post-check=0,
> pre-check=0");
>                 header("Cache-Control: private",false); // required
> for certain browsers
>                 header("Content-Type: $ctype");
>                 header("Content-Disposition: attachment; filename=
> \"$basename\";" );
>                 header("Content-Transfer-Encoding: binary");
>                 readfile($file);
>                 exit();
>         }
>
> }


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to