문제

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

도움이 되었습니까?

해결책

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?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top