php - echo the contents of a File to the user but make it act as a download -


I have a script where I get the contents of a file and then it resonates on the screen, the problem is that An example of a binary file on the page, what should I do if it works like a download where the download dialog will appear.

How can I get it?

From the PHP manual:

  // We have a PDF header output ('Content-type: app / pdf'); // it will be downloaded .pdf header ('content-dispute: attachment; filename =' downloaded PDF ''); // pdf source is in original PDF readfile ('original PDF');  < / Pre> 

Change the content-type and file name. You can readfile the user on file_get_contents, but either work or


Comments

Popular posts from this blog

paypal - How to know the URL referrer in PHP? -

oauth - Facebook OAuth2 Logout does not remove fb_ cookie -

wpf - Line breaks and indenting for the XAML of a saved FlowDocument? -