function preview(){
if(...){//if user have select file
//do something if input file onchange.
}else{
alert('please select a file');
}
}
<input type='file' name='file' onchange='preview(this);' />
I have an input file, onchange will do something.
However I need to check if user has select the file.
Is anyway to check input file is not empty?