How do people usually detect the MIME type of an uploaded file using ASP.NET?
MIME detection This uses the GNU file utility to determine the type of the file, which should work right away under Linux. Note that the file utility provided by other Unixes may not support the -i option, and will thus not work.
A media type, also called a MIME type, identifies the format of a piece of data. In HTTP, media types describe the format of the message body. A media type consists of two strings, a type and a subtype. For example − text/html.
in the aspx page:
<asp:FileUpload ID="FileUpload1" runat="server" />
in the codebehind (c#):
string contentType = FileUpload1.PostedFile.ContentType
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