Skip to content

Instantly share code, notes, and snippets.

@SamWM
Created December 22, 2009 16:50
Show Gist options
  • Save SamWM/261850 to your computer and use it in GitHub Desktop.
Save SamWM/261850 to your computer and use it in GitHub Desktop.
public static string ExtensionFromContentType(string contenttype)
{
string output = ".jpg";
switch (contenttype)
{
case "image/gif":
output = ".gif";
break;
case "image/png":
output = ".png";
break;
case "image/jpg":
case "image/jpeg":
case "image/pjpeg":
output = ".jpg";
break;
default:
break;
}
return output;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment