Check if uploaded file is CSV Format or not in php

$csv_mimetypes = array(
    ‘text/csv’,
    ‘text/plain’,
    ‘application/csv’,
    ‘text/comma-separated-values’,
    ‘application/excel’,
    ‘application/vnd.ms-excel’,
    ‘application/vnd.msexcel’,
    ‘text/anytext’,
    ‘application/octet-stream’,
    ‘application/txt’,
);
if (in_array($_FILES[‘upload’][‘type’], $csv_mimetypes)) {
    // possible CSV file
    // could also check for file content at this point
}