Use libmagic for file type detection.

Description:
Up to this commit based on file extensions their content types where being identified. With this modification the libmagic library will be used for this task.