JSFiddle - React, Tailwind, and code Playground

HTML

<input type='file' id='input' />

JavaScript

var input = document.getElementById('input')

input.addEventListener('click',enter)

function enter()
{
    document.body.addEventListener('focusin',leave)
}
    
function leave()
{
	setTimeout(function(){
      if(input.value.length) alert('Есть файлы')
      else alert('Файлов нет')
      document.body.removeEventListener('focusin',leave)
    },100)
}