At the server level in IIS, go to MIME Types and add the type there. Microsoft SharePoint Server MVP. When testing my game web builds on localhost, I get the error 'Failed to download data file'. The game data file is correctly placed, and the page loads fine, it just wont download the plugin, or p.
KB ID 0001158
Problem
I needed to get a web server up and running today, so I could upload some files into a firewall via http. I have a copy of Windows 10 running on my mac in VMware fusion, so that’s what I thought I would use.
Solution
Open a command window and run appwiz.cpl > Turn Windows features on or off > Internet Information Services > OK > Follow the instructions.
Now to test, open a browser window and navigate to http://localhost. You should see the IIS welcome page.
Windows IIS Add A File Extension For ‘Download’
I needed to download a file with a .SPA exntention, this didn’t work, because I needed to add that file extension for download. Open IIS Management console > Expand {server-name} > Sites > Default Web Site > MIME Types > Add > Type in the file extension > Set the MIME Type to application/octet-stream > OK.
Normally the files I needs are in .BIN format, but this file extension is already included by default.
Related Articles, References, Credits, or External Links
Add Dmg To Iis Mime Type 2
NA
Mime Type Php Iis
Here is a simple way to control who downloads your files...
You will have to set: $filename, $downloaddir, $safedir and $downloadURL.
Basically $filename is the name of a file, $downloaddir is any dir on your server, $safedir is a dir that is not accessible by a browser that contains a file named $filename and $downloadURL is the URL equivalent of your $downloaddir.
The way this works is when a user wants to download a file, a randomly named dir is created in the $downloaddir, and a symbolic link is created to the file being requested. The browser is then redirected to the new link and the download begins.
The code also deletes any past symbolic links created by any past users before creating one for itself. This in effect leaves only one symbolic link at a time and prevents past users from downloading the file again without going through this script. There appears to be no problem if a symbolic link is deleted while another person is downloading from that link.
This is not too great if not many people download the file since the symbolic link will not be deleted until another person downloads the same file.
Anyway enjoy:
<?php
$letters = 'abcdefghijklmnopqrstuvwxyz';
srand((double) microtime() * 1000000);
$string = ';
for ($i = 1; $i <= rand(4,12); $i++) {
$q = rand(1,24);
$string = $string . $letters[$q];
}
$handle = opendir($downloaddir);
while ($dir = readdir($handle)) {
if (is_dir($downloaddir . $dir)){
if ($dir != '.' && $dir != '..'){
@unlink($downloaddir . $dir . '/' . $filename);
@rmdir($downloaddir . $dir);
}
}
}
closedir($handle);
mkdir($downloaddir . $string, 0777);
symlink($safedir . $filename, $downloaddir . $string . '/' . $filename);
Header('Location: ' . $downloadURL . $string . '/' . $filename);
?>