Finally figured it out. This code throws an error if the filetype is not allowed. Hope this
helps some newbie save a little time.
global $post;//http://wordpress.stackexchange.com/questions/39753/
if ($_FILES) {
$files = $_FILES['upload'];
foreach ($files['name'] as $key => $value) {
if ($files['name'][$key]) {
$file = array(
'name' => $files['name'][$key],
'type' => $files['type'][$key],
'tmp_name' => $files['tmp_name'][$key],
'error' => $files['error'][$key],
'size' => $files['size'][$key]
);
$uploaded_file_type = $files['type'][$key];
$allowed_file_types = array('image/jpg', 'image/jpeg', 'application/pdf');
if(in_array($uploaded_file_type, $allowed_file_types)) {
//if in array run the attachment function
$_FILES = array("upload" => $file);
foreach ($_FILES as $file => $array) {
$newupload = insert_attachment($file,$post_id);
}
} else { // wrong file type
$upload_error .= "Invalid File Type. <br />";
}
}
}
}