i have a workflow where user is allowed to upload any file and then that file will be read.
Now my question is if user have image file xyz.jpg and he renamed it to
You can use the unmanaged function FindMimeFromData in urlmon.dll.
using System.Runtime.InteropServices;
[DllImport(@"urlmon.dll", CharSet = CharSet.Auto)]
private extern static System.UInt32 FindMimeFromData(
System.UInt32 pBC,
[MarshalAs(UnmanagedType.LPStr)] System.String pwzUrl,
[MarshalAs(UnmanagedType.LPArray)] byte[] pBuffer,
System.UInt32 cbSize,
[MarshalAs(UnmanagedType.LPStr)] System.String pwzMimeProposed,
System.UInt32 dwMimeFlags,
out System.UInt32 ppwzMimeOut,
System.UInt32 dwReserverd
);
See here for an example usage.