Changed mime type detection to use PHP native function not wordpress as sometimes returned NULL
Comment out console.log()
Update:: Replaced mime_content_type() with finfo_open. mime_content_type deprecated