so i want to get the file extension from the img so if i upload a image i can use mutiple file exts but when i use this code to get the file ext it does not work
$sql = "SELECT * FROM users";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_assoc($result)) {
$id = $row['user_id'];
$sql = "SELECT * FROM users WHERE user_id='$id'";
$result = mysqli_query($conn, $sql);
while ($rowImg = mysqli_fetch_assoc($result)) {
if ($rowImg['status'] == 0) {
$filename = "../assets/IMGS/profile/Avatar".$id.".*";
$fileinfo = glob($filename);
$fileext = explode(".", $fileinfo[0]);
$fileactualext = $fileext[1];
echo "<img src='../assets/IMGS/profile/Avatar".$id.".".$fileactualext."?".mt_rand()."'>";
} else {
echo '<img src="../assets/IMGS/profile/def-image.png">';
}
}
}
}