finfo_file()
for File Type Detectionfinfo_file()
for File Type DetectionUse the finfo_file()
function from the Fileinfo extension to detect the MIME type of a file. This is more reliable than relying on file extensions, ensuring accurate file type detection.