My PHP script:
Code: Select all
<?php
if (isset($_POST['submit'])) {
$Clicked = ($_REQUEST['clicked']);
$filename = "MyProgramInstaller.exe";
$filetype = "octet-stream";
$Recip = "hello@world.net";
$Subj = "MyProgramInstaller download occurred";
$Msg = "A visitor has downloaded a copy of MyProgramInstaller.exe.";
$Sender = "downloads@website.com";
$Nickname = "Downloads";
if ((isset($Clicked)) && (file_exists($filename))) {
// Send the file.
header ("Content-Type: application/$filetype");
header ("Content-disposition: attachment; filename=$filename");
readfile ($filename);
// Send the email.
mail("$Recip", "$Subj", "$Msg", "From: $Nickname <$Sender>\r\nReply-To: $Nickname <$Sender>\r\n" );
}
}
?>Code: Select all
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<input type="hidden" name="clicked" value="TRUE">
<input src="images/nav/download.gif" type="image" name="submit" value="Download Now!" alt="Download MyProgramInstaller" class="swapformbtn">
</form>None have worked yet in Internet Explorer, but all work in Firefox.
I should add that the web site is on a shared commercial hosting server. I will not be able to edit any Apache config files, but must settle on using a MIME type in my script that a default installation of Internet Explorer knows how to handle.
Any help is most appreciated.