How to Detect a File Format and Check if the File is Encrypted

Contents
[ ]

The following sample code illustrates how to detect a file format (using the file path) and check its extension. You can also determine whether the file is encrypted.