lundi 21 juin 2021

strange filename callback after file selection finish

i beg your pardon

i write following sample html code,

which will display the result after file selection has finished

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Upload</title>
</head>
<body>
  <input id="file-input" type="file" />
  <script>
    const fileInput = document.querySelector('#file-input');
    fileInput.onchange = function(){
      console.log('file name:', this.value)
    }
  </script>
</body>
</html

i prepare two window shortcut file (produced by Desktop ---> right click ---> new ---> shortcut)

1、the first shortcut file

target is https://www.baidu.com/

file name is www.baidu.com

after select this file, output "C:\fakepath\www.baidu.com.url " in callback

it is ok

2、the second shortcut file

target is https://www.google.com/

file name is www.google.com

after select this file, i expect it will output "C:\fakepath\www.google.com.url " in callback, but it output something likes "C:\fakepath\TQCJEVEM"

why this happen; appreciate you help; thanks;




Aucun commentaire:

Enregistrer un commentaire