Posted in
Windows Powershell |
No Comment | 4,352 views | 29/01/2016 21:01
This is an example Mime Type script to show you how to get it:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
| # Create Content Type Map
$ContentTypeMap = @{
".jpg" = "image/jpeg";
".jpeg" = "image/jpeg";
".gif" = "image/gif";
".png" = "image/png";
".tiff" = "image/tiff";
".zip" = "application/zip";
".json" = "application/json";
".xml" = "application/xml";
".rar" = "application/x-rar-compressed";
".gzip" = "application/x-gzip";
}
$File = Get-ChildItem C:\YourFilePath.json
$FileMimeType = $ContentTypeMap[$File.Extension.ToLower()];
Write-Output $FileMimeType |
# Create Content Type Map
$ContentTypeMap = @{
".jpg" = "image/jpeg";
".jpeg" = "image/jpeg";
".gif" = "image/gif";
".png" = "image/png";
".tiff" = "image/tiff";
".zip" = "application/zip";
".json" = "application/json";
".xml" = "application/xml";
".rar" = "application/x-rar-compressed";
".gzip" = "application/x-gzip";
}
$File = Get-ChildItem C:\YourFilePath.json
$FileMimeType = $ContentTypeMap[$File.Extension.ToLower()];
Write-Output $FileMimeType
You can get mime types from IIS.