The user loads the logo, the file is assigned a name: userID<имя файла>.<расширение>
How then to bring the logo to the page?
<img src="/images/<?php echo $userID;?>???.???"> The user loads the logo, the file is assigned a name: userID<имя файла>.<расширение>
How then to bring the logo to the page?
<img src="/images/<?php echo $userID;?>???.???"> Use the glob function - it is able to return the list of files by mask. It is only necessary to correctly handle the situation if there are several files or nothing is found. Somewhere like this (I haven’t written to php long ago)
$f = glob("images/$userID*"); if (count($f) == 0) { echo "<img src=\"/images/none.png\">"; } else { echo "<img src=\"/images/".$f[0].".png\">"; } Source: https://ru.stackoverflow.com/questions/360594/
All Articles