Image Size, File Size, File Extension
Hi,
again, I need to know how to validate these things.
File size 4MB (4194304 Byte)
Image size min. 400x400 pixel
File Extension jpg, png, gif, jpeg
<?php
if (isset($_POST["buttonUpload"]) || isset($_POST["buttonUpload_x"])) {
$WAFV_Redirect = "";
$_SESSION['WAVT_upload_078_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
}
$WAFV_Errors = "";
$WAFV_Errors .= WAValidateRX(((isset($_POST["title"]))?$_POST["title"]:"") . "","/^$/i",false,1);
$WAFV_Errors .= WAValidateRQ(((isset($_FILES["image"]))?$_FILES["image"]["name"]:"") . "",true,2);
$WAFV_Errors .= WAValidateNM(((isset($_FILES["image"]))?$_FILES["image"]["size"]:"") . "",0,4194304 ,""," ,",true,3);
$WAFV_Errors .= WAValidateNM(WADFP_getImageWidth((isset($_FILES["image"]))?$_FILES["image"]:"") . "",400,"",""," ,",true,4);
$WAFV_Errors .= WAValidateNM(WADFP_getImageHeight((isset($_FILES["image"]))?$_FILES["image"]:"") . "",400,"",""," ,",true,5);
$WAFV_Errors .= WAValidateFE(((isset($_FILES["image"]))? preg_replace('/^.*\./', '', $_FILES["image"]["name"]) :"") . "",".gif, .jpg, .jpeg, .png",true,6);
$WAFV_Errors .= WAValidateEM(((isset($_POST["email"]))?$_POST["email"]:"") . "",true,7);
$WAFV_Errors .= WAValidateLE(((isset($_POST["emailConfirm"]))?$_POST["emailConfirm"]:"") . "",((isset($_POST["email"]))?$_POST["email"]:"") . "",true,8);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["gender"]))?$_POST["gender"]:"") . "",true,9);
$WAFV_Errors .= WAValidateEL(((isset($_POST["firstname"]))?$_POST["firstname"]:"") . "",2,250,true,10);
$WAFV_Errors .= WAValidateEL(((isset($_POST["lastname"]))?$_POST["lastname"]:"") . "",2,250,true,11);
$WAFV_Errors .= WAValidateEL(((isset($_POST["street"]))?$_POST["street"]:"") . "",2,250,true,12);
$WAFV_Errors .= WAValidateEL(((isset($_POST["postcode"]))?$_POST["postcode"]:"") . "",5,5,true,13);
$WAFV_Errors .= WAValidateAN(((isset($_POST["postcode"]))?$_POST["postcode"]:"") . "",false,false,true,false,"",true,14);
$WAFV_Errors .= WAValidateEL(((isset($_POST["city"]))?$_POST["city"]:"") . "",2,250,true,15);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["rights"]))?$_POST["rights"]:"") . "",true,16);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["terms"]))?$_POST["terms"]:"") . "",true,17);
$WAFV_Errors .= WAValidateLE(((isset($_POST["Security_Code_1"]))?$_POST["Security_Code_1"]:"") . "",$_SESSION['captcha_Security_Code_1'] . "",true,18);
$WAFV_Errors .= WAValidateRX(((isset($_POST["reprise"]))?$_POST["reprise"]:"") . "","/^$/i",false,19);
$WAFV_Errors .= WAValidateNM(((isset($_FILES["image"]))?$_FILES["image"]["size"]:"") . "",0,4194304 ,"",",.",true,20);
$WAFV_Errors .= WAValidateNM(WADFP_getImageWidth((isset($_FILES["image"]))?$_FILES["image"]:"") . "",400,"","",",.",true,21);
$WAFV_Errors .= WAValidateNM(WADFP_getImageHeight((isset($_FILES["image"]))?$_FILES["image"]:"") . "",400,"","",",.",true,22);
if ($WAFV_Errors != "") {
PostResult($WAFV_Redirect,$WAFV_Errors,"upload_078");
}
}
?>
This seems not to work :-(
It would be nice to have a video for all those things.
Cheers,
Denis