Required file Validation problem
I have a form that requires a pdf file to be uploaded.
I validate by type (pdf) correctly but when I try to add a required validation, the file is not being recognized. I think I must have made an error in how I am applying the validation.
Here is the server validation:
<?php
if (isset($_POST["Insert_x"])) {
$WAFV_Redirect = "pdfFiles_Insert.php?invalid=true";
$_SESSION['WAVT_pdfFilesInsert_376_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
}
$WAFV_Errors = "";
$WAFV_Errors .= WAValidateFE(((isset($_FILES["pdfUpload"]))?$_FILES["pdfUpload"]["name"]:"") . "",".pdf",false,1);
$WAFV_Errors .= WAValidateRQ(((isset($_FILES["pdfUpload"]))?$_FILES["pdfUpload"]["name"]:"") . "",".pdf",false,2);
if ($WAFV_Errors != "") {
PostResult($WAFV_Redirect,$WAFV_Errors,"pdfFilesInsert_376");
}
}
?>
Here is the file field with the validation errors:
<input type="file" name="pdfFile" id="pdfFile" />
<?php
if (ValidatedField('pdfFilesInsert_376','pdfFilesInsert_376')) {
if ((strpos((",".ValidatedField("pdfFilesInsert_376","pdfFilesInsert_376").","), "," . "1" . ",") !== false || "1" == "")) {
if (!(false)) {
?>
<br />
<span class="errorRed"><img src="images/icon-error.gif" alt="" width="16" height="14" align="baseline" /> You can only upload PDF files.</span>
<?php //WAFV_Conditional pdfFiles_Insert.php pdfFilesInsert_376(1:)
}
}
}?>
<?php
if (ValidatedField('pdfFilesInsert_376','pdfFilesInsert_376')) {
if ((strpos((",".ValidatedField("pdfFilesInsert_376","pdfFilesInsert_376").","), "," . "2" . ",") !== false || "2" == "")) {
if (!(false)) {
?>
<br />
<span class="errorRed"><img src="images/icon-error.gif" alt="" width="16" height="14" align="baseline" /> Please select a PDF file.</span>
<?php //WAFV_Conditional pdfFiles_Insert.php pdfFilesInsert_376(2:)
}
}
}?>
Can anyone point out what I am doing wrong.
Thanks in advance.