After selecting the file for the first time, click the button again. After the dialog box pops up, you do not select the file but choose to cancel. The file selected for the first time is gone. . . Showing no files selected
怪我咯2017-07-05 11:10:02
If you have special needs, you can use a temporary variable to save the value of the last operation, for example, after the file selection event is triggered
var prevFile = null;
fileElement.onchange = function(){
var file = fileElement.files[0] || prevFile;
if(!file) return false;
///此处省略一大段逻辑///
prevFile = file;
};