validate upload file extension
I seem to be having a problem validating the file extension for my upload. I only want the visitor to be able to upload JPGs. The form page submits to itself. When I try to add "Server Validation", I get an error when I click on the "Server Variable" lightning bolt that states:
error in generateDynamicSource Bindings:
TypeError: foundUploadFileNames[x][2] has no properties
If I proceed, I can finish my selections and the wizard will write the code below. However, all uploads fail the validation.
What have I done wrong?
<?php
if (isset($_POST["submitEntry"])) {
$WAFV_Redirect = "contestEntryForm.php";
$_SESSION['WAVT_contestEntryForm_140_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
}
$WAFV_Errors = "";
$WAFV_Errors .= WAValidateFE(((isset($_FILES["image_filename"]))? preg_replace('/.[^.]*$/', '', $_FILES["image_filename"]["name"]) :"") . "",".jpg, .jpeg",true,1);
if ($WAFV_Errors != "") {
PostResult($WAFV_Redirect,$WAFV_Errors,"contestEntryForm_140");
}
}
?>