DeX Posted October 9, 2015 Share Posted October 9, 2015 I have a job management portal which I built and it allows my client to create PDF files of quotes for their customers. They send their customer a link (token based URL) so their customers can click the link and view the quote. I want to serve up the PDF file on screen for their customer to view, how can I do this? Each time I attempt it, Chrome asks me if I would like to download the file. I just want to view it without the customer having a direct link to it. Quote Link to comment Share on other sites More sharing options...
Solution Jacques1 Posted October 9, 2015 Solution Share Posted October 9, 2015 The easiest option is to send the appropriate content type with header() and then show the file content with readfile(). <?php header('Content-Type: application/pdf'); readfile('/path/to/pdf'); A more sophisticated and efficient approach is to delegate the file transfer to the webserver: mod_xsendfile for Apache X-Accel for nginx 1 Quote Link to comment Share on other sites More sharing options...
DeX Posted October 13, 2015 Author Share Posted October 13, 2015 You were right, that worked perfectly. Thank you! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.