Add Dmg To Iis Mime Type

KB ID 0001158

  1. Add Dmg To Iis Mime Type Extension
  2. Add Dmg To Iis Mime Types
  3. Add Dmg To Iis Mime Type 2
  4. Add Dmg To Iis Mime Type Video
  5. Aspx Mime Type Iis
Add

Problem

Dmg
  • Art of Code, Software for Life.
  • I’m currently building a HTML 5 website, using Microsoft’s www.beautyoftheweb.com as inspiration. Taking inspiration sometimes means “borrowing” some of the graphics and styles on a site you like.

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.

Set mime type

In order to allow loading and downloading json file on your site, you have to add json extension in mime type and handler mappings in IIS windows server.

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.

Add Dmg To Iis Mime Type Extension

Windows IIS Add A File Extension For ‘Download’

Add Dmg To Iis Mime Types

Type

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.

Add Dmg To Iis Mime Type 2

Normally the files I needs are in .BIN format, but this file extension is already included by default.

Add Dmg To Iis Mime Type Video

Related Articles, References, Credits, or External Links

NA

Aspx Mime Type 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);
?>