I have a CSV file, which is converted from a UNICODE to CSV file. I did this to process UTF-8 character. So here is the problem, I have a CSV file but when I tried to upload it, seems like it is not accepted as a CSV file. The csv file is somewhat read as a UNICODE from it's origin. When I used this condition to validate the file, it is bypass and generate an error, This condition works just fine on other instances.
$mimes = array('application/vnd.ms-excel','text/plain','text/csv','text/tsv');
if( !empty($_FILES['csv_attach']['tmp_name']) && in_array($_FILES['csv_attach']['type'],$mimes))
{
/* some codes */
}
Now the question is that, how can you validate if the file is a valid CSV file, not a UNICODE text file? Or how can you validate if the file is a UNICODE TEXT? That's what I am thinking for the solution, just to validate the file if it is a UNICODE text or not. Am I missing something?