Two solutions for clearing the selected file of the input file

  • 2020-03-26 21:33:51
  • OfStack

When uploading a file, after selecting the file to clear the file path, search, with two methods to solve
 
<input type="file" id="fileupload" name="file" /> 

The first:
 
var obj = document.getElementById('fileupload') ; 
obj.select(); 
document.selection.clear(); 

The second:
 
var obj = document.getElementById('fileupload') ; 
obj.outerHTML=obj.outerHTML; 

Related articles: