I have the next content-types:
image/gif
image/png
application/vnd.ms
They all work and recognized the files (gif, png, xls)...
But what is the content-type for jpg? i know that its the type for jpeg:
image/pjpeg , image/jpeg
But it's not work for jpg.
(I use that with the code:
if (contentType == "image/JPEG") .....
if (contentType == "image/gif")...
For category the files by their extension. maybe there is other way to do that? not by content- type ?)
Caveat: I know almost zero C#.
I suspect this is a casing issue. Try this:
if (contentType.ToLower() == "image/jpeg")
RFC1341 indicates that
The type, subtype, and parameter names are not case sensitive. For example, TEXT, Text, and TeXt are all equivalent.
This means that if contentType is coming verbatim from a user-agent, it could have any capitalization, or none at all.
It seems that your code is case sensitive. Try:
if (contentType == "image/jpeg") .....
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With