How can u download a php file?!
Posted: Wed Jul 16, 2003 12:55 pm
Is there any way at all that u can download a php file without it executing?
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
If you want the user to be prompted to save the data you are sending, such as a generated PDF file, you can use the Content-Disposition header to supply a recommended filename and force the browser to display the save dialog.
Note: There is a bug in Microsoft Internet Explorer 4.01 that prevents this from working. There is no workaround. There is also a bug in Microsoft Internet Explorer 5.5 that interferes with this, which can be resolved by upgrading to Service Pack 2 or later.Code: Select all
<?php // We'll be outputting a PDF header("Content-type: application/pdf"); // It will be called downloaded.pdf header("Content-Disposition: attachment; filename=downloaded.pdf"); // The PDF source is in original.pdf readfile('original.pdf'); ?>
Note: If safe mode is enabled the uid of the script is added to the realm part of the WWW-Authenticate header if you set this header (used for HTTP Authentication).