IE 11 lock the file when using HTML input=file tag

2020-07-17 08:09发布

问题:

  1. I choose the file using browse in the file input in IE11

  2. I deleted the file using shift+delete in the Explorer

  3. Then when I refresh the folder, the file that I deleted reappear again in Explorer.

Is there anyway that I can release the file handle by at the client side javascript? I tried that test in IE 8 but that issue didn't occurred.

Any kind help is appreciated.

回答1:

I could release the file handler as following in IE 11.

    document.getElementById("fileToUpload").value=""; // input file field
    document.getElementById("uploadForm").reset(); // form that containing input file field