1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
$validator = $pp->getValidator();
$validator->fields(['name','email'])->areRequired()->maxLength(50);
$validator->field('objet')->areRequired(120);
$validator->field('email')->areRequired()->isEmail();
$validator->field('message')->areRequired()->maxLength(6000);
$validator->field('image')->areRequired();
$target_dir = "uploads/";
$target_file = $target_dir . basename($_FILES["image"]["name"]); // <- la ligne 22 détectée est celle ci
$uploadOk = 1;
$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
if(isset($_POST["submit"])) {
$check = getimagesize($_FILES["image"]["tmp_name"]);
if($check !== false) {
echo "Votre fichier est conforme " . $check["mime"] . ".";
$uploadOk = 1;
} else {
echo "Votre fichier n'est pas conforme.";
$uploadOk = 0;
}
} |
Partager