Quantcast
Channel: My Science Is Better » zend framework
Viewing all articles
Browse latest Browse all 10

HTTP response headers in Zend Framework

$
0
0

I needed to display a Zend Framework generated PDF using the browser plugins and after a bit of looking around it turns out that some headers need to be set in order to achieve that.

$this->getResponse()
     ->setHeader('Content-Disposition', 'inline; filename=invoice.pdf')
     ->setHeader('Content-type', 'application/x-pdf');

If you’d want to automatically download the PDF instead of displaying it using the browser plugins, you need to change the ‘Content-Disposition’ as follows:

$this->getResponse()
     ->setHeader('Content-Disposition', 'attachment; filename=invoice.pdf')
     ->setHeader('Content-type', 'application/x-pdf');

The post HTTP response headers in Zend Framework appeared first on My Science Is Better.


Viewing all articles
Browse latest Browse all 10

Latest Images

Trending Articles





Latest Images