To validate the file size, use Integer type validation on the "size" attribute of the uploaded file. The value will be in bytes, so you would validate that the file size is less than: 2000000 for 2MB.
The final validation code will look something like:
<?php
if ($_SERVER["REQUEST_METHOD"] === "POST") {
$WAFV_Redirect = "Gestiondocumentos.php";
$_SESSION['WAVT_Gestiondocumentos_361_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
}
$WAFV_Errors = "";
$WAFV_Errors .= WAValidateFE(((isset($_FILES["nombre_doc"]))? preg_replace('/^.*\./', '', $_FILES["nombre_doc"]["name"]) :"") . "",".jpg, .jpeg, .doc, .docx, .xls, .xlsx, .pdf, .zip, .rar",true,1);
$WAFV_Errors .= WAValidateNM(((isset($_FILES["nombre_doc"]))? preg_replace('/^.*\./', '', $_FILES["nombre_doc"]["size"]) :"0") . "",0,2000000,"",",.",true,2);
if ($WAFV_Errors != "") {
PostResult($WAFV_Redirect,$WAFV_Errors,"Gestiondocumentos_361");
}
}
?>