I see in the thread: How to check file types of uploaded files in PHP? davr suggests the use of:
system("file -bi $uploadedfile")
to check the file type as a safety measure. porneL makes this suggested addition:
system("file -bi -- ".escapeshellarg($uploadedfile))
Could someone explain how executing a potentially hazardous file with the system() function is a safe way to determine a file type?