PHP preg_match文件名为MONTHYEAR.txt或.csv,并在上传时返回true或false

How would I return true or false, uploading a file matching the FULL_WRITTEN_MONTH and YEAR.txt or .csv

Examples:

JANUARY2015.txt

MARCH2016.csv

DECEMBER2017.txt

would validate to true.

december2013 = false

dec2013 = false

dec 2013 = false

if($_SERVER['REQUEST_METHOD'] == 'POST') {

$target_dir = "uploads/";

$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);

$uploadOk = 1;

$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);

// Check if image file is a actual image or fake image
if(isset($_POST["submit"])) {
$check = filesize($_FILES["fileToUpload"]["tmp_name"]);
if($check !== false) {
    echo "File is an file - " . $check["mime"] . ".";
    $uploadOk = 1;
} else {
    echo "File is not a file.";
    $uploadOk = 0;
}
}
// Check if file already exists
if (file_exists($target_file)) {
echo "Sorry, file already exists.";
$uploadOk = 0;
}
// Check file size
if ($_FILES["fileToUpload"]["size"] > 500000) {
echo "Sorry, your file is too large.";
$uploadOk = 0;
}
// Allow certain file formats
if($imageFileType != "txt" || $imageFileType != "csv") {
echo "Sorry, only TXT CSV files are allowed.";
$uploadOk = 0;
}
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
echo "Sorry, your file was not uploaded.";
// if everything is ok, try to upload file
} else {
if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"],    $target_file)) {
    echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded.";
} else {
    echo "Sorry, there was an error uploading your file.";
}

}

To get you started:

<?php

$a = 'DECEMBER2015';
$b = 'december2015';

foreach (array('DECEMBER' ) as $month)
{
    var_dump($month.'2015' == $a); //true
    var_dump($month.'2015' == $b); //false
}

?>

Make two looping for example, going to a range of years and the months.