The Mimetype method of the FileType class seems to be a way to specify which file types your app uses. But can it be used to read in the mimetype of a file? i.e. If I use FolderItem with a .txt file I don’t want to rely on the file extension to determine file type, but rather I want to verify it based on the mimetype info.
Note that I am not using an OpenDialog to select the file
If this is a one shot (or one time), you can add a File Type Group^top the Navigation pane, then drop the file whose extension you want to know…
Easy, isn’t it ?
More thanks to Greg for disclosing this trick.
PS: when finished, you can delete it. Check the File Type (the by code version) is still here when you need it / before using it.
For macOS the UTIs are relevant (Uniform Type Identifiers | Apple Developer Documentation) and not MimeTypes. Those I need for emails and now for message attachments. For all emails I check if the file really contains what it says. For messages the information is more reliable. But even there I have some checks like GIF files starting with “GIF87a” or “GIF89a”.
thanks everyone. this isn’t a once off, in short i don’t want to trust the file extension in case malware sneaks in (this is not my only protection mechanism)
@Rick_Araujo when you say that you’ve compiled a pack, what does that mean exactly? i see your zip file has binary content, so wondering where the code from that comes from
The GNUWin project has a lot of sparse contents, bins in one place, libs in another, dependencies in another, etc. I managed to get the minimal set able to make file.exe packed together and working.