doureng6738 2013-11-22 19:04
浏览 39
已采纳

将cakeresponse保存到服务器

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条回答 默认 最新

  • dsn5510 2013-11-22 19:41
    关注

    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?

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 求用stm32f103c6t6在lcd1206上显示Door is open和password:
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类