1

im using CakePHP 2.1 and DOMPDF to generate some reports the process is working fine but i can only promt the user to download the file from the controller action using:

$this->response->download('filename');

or open the file in the browser

i am not using any dompdf function to generate the files, the only thing different from accesing a normal view is that i generate the files by adding '.pdf' to the urls like:

mysite.com/controller/action.pdf

I have a folder for my controller view files (one view file for each action in the controller) and inside that folder i have another folder called pdf where i have put the view file for the action that is generating the pdf file, this view file is a normal .ctp file with all the html/php needed to correctly generate the pdf file

The thing i want its to be able to save the generated pdf file to the server so that i can setup a cronjobs to send this files daily at night. The generated file is rendered as a pdf file and can be handled with cakeresponse.

thank you

1 Answers1

0

Well, instead of sending the content just store the file on disk and keep a reference to that file so that you know the file belongs to a certain record.

When requested get the file from disk and send it. I don't get your problem here? Either this is a "write the code for me" style question or are you simply asking for that concept?

floriank
  • 25,546
  • 9
  • 42
  • 66
  • the problem is that i dont know how to save the file to the disk, i can only promt the user to download it or open it in the browser i would like a way to save it in the disk automatically because this report is filled when im not i the office so i cant be the one generating it – Carlos Montoya Nov 22 '13 at 19:54
  • See http://stackoverflow.com/questions/8720897/how-to-save-dompdf-generated-content-to-file – floriank Nov 22 '13 at 20:45