MIME types are not relevant to posted files. Why? Because you're dealing
with the file system, not anything to do with the web. When the posted file
is uploaded, it is simply an array of bytes (characters). The file type is
identified in the same way that the file system identifies any file type -
by its extension. If the file has no extension, and the program doesn't tell
the OS what type of file it is (text or binary), the OS has no way of
knowing the file type.
Therefore, you either need to make sure the file has the correct extension,
or know the file type and tell the app what type of file to save it as.
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
"ME via .NET 247" <an*******@dotnet247.com> wrote in message
news:uE**************@TK2MSFTNGP12.phx.gbl...
I have a question about how System.Web.HttpPostedFile manages mime types
using property ContentType in Windows.
When I upload a known "text/plain" file with no extension the property
doesnt recognizes the type, showing a blank string or some weird
characters. But if I put an extension like .pdf ou .exe to that same file
the ContentType shows "text/plain".
Is that result expected?
-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)
<Id>UcNXN7/muky2x65KnkV4Gg==</Id>