I had a problem. My condition always returns "All fields must be completed". What should I do? Thank you for your help ...
if (! empty ($ _ FILES ['myFile'] ['name'])) {
$ fileImage = $ _FILES ['myFile'] ['name'];
$ extension = pathinfo ($ fileImage, PATHINFO_EXTENSION);
$ tmp_name = $ _FILES ["myFile"] ["tmp_name"];
if ((exif_imagetype ($ tmp_name) == 2) || (exif_imagetype ($ tmp_name) == 3)) {
$ userAvatar = $ _SESSION ['id']. '.' . $ Extension;
$ uploadDestination = "img / avatars /". $ Useravatar;
$ insertAvatar = $ db-> prepare ("UPDATE member SET avatar =? WHERE id =?");
$ insertAvatar-> execute (array ($ userAvatar, $ _SESSION ['id']));
move_uploaded_file ($ tmp_name, $ uploadDestination);
header ( 'Location: profil.php? id =' $ _ SESSION [ 'id'].)
} else {
$ error = 'This format is not taken into account!';
}
} else {
$ error = "All fields must be completed";
}