Code:
if(isset($_POST['update_avatar'])) {
    $url = $_POST['avatar'];
    $info = getimagesize($url);
    if(isset($info['name'])) {
        echo "Exists";
    } else {
        echo "Error";
    }
}
How can I avoid getting PHP errors when the user types an invalid URL, random piece of text or invalid image URL etc?
 
     
     
    