search
Categories
Sponsors
VirtualMetric Hyper-V Monitoring, Hyper-V Reporting
Archive
Blogroll

Badges
MCSE
Community

Cozumpark Bilisim Portali
Getting File Content Mime Type with PowerShell
Posted in Windows Powershell | No Comment | 1,083 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

You can get mime types from IIS.



Leave a Reply