The browser security mechanism cannot get the path to the uploaded file

so, I"m going to implement a function now.

  • first select a local file
  • then click on the file (the effect is similar to uploading a file, but it will not be opened after clicking)
  • generate a link on the page after clicking
  • Click the link to open the file (assuming the file is in a format that can be parsed by the browser)

if I can"t get the path of uploading files because of browser security, what method do I need to achieve the above functions?


FileReader.readAsDataURL (if the file is small enough)

large files may be possible with iframe+createObjectURL, but I haven't tried

Menu