Here is the code I have for that, but it never returns true.
    $image = $_FILES['image'];
    $filename = $image['name'];
    $filepathname = "/$membername/"."$filename";
    if (file_exists($filepathname)) {
       throw new Exception('Image already exists');
    }
 
     
     
    