I am working on a module that takes a user-uploaded CSV file. Code looks like this:
function foo_form_submit($form_id, &$form_state) {
$validators = array();
$dest = 'sites/phoenix.dev/files';
$uploaded_file = file_save_upload('upload', $validators, $dest);
//some other stuff
}
As you can see, I don't pass anything in to validate that the file in the 'upload' field is actually a .csv file. This would cause some nasty things to happen later on in the function. How do I use the validators to check that the extension is .csv, or even better, to check that it actually IS a .csv file?
Edit: and Google search did not turn up anything too helpful.