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

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -