Check File exist in Folder using Javascript

后端 未结 4 695
灰色年华
灰色年华 2021-01-29 15:28

I want to check a file exist in folder. Below code is while i\'m trying to many times is not working.






        
相关标签:
4条回答
  • 2021-01-29 15:48

    As I learned years ago you cannot access local file system with JS from browser, but things change. You can find more info here:

    Local file access with javascript

    The article directs you to MDN but the solution works only in certain browsers:

    https://developer.mozilla.org/en-US/docs/Web/API/File_and_Directory_Entries_API

    0 讨论(0)
  • 2021-01-29 15:58

    You can't access local files in modern web browsers. There is the HTML5 File API, but that involves direct user actions, you can't just use whatever files you please.

    0 讨论(0)
  • 2021-01-29 15:58

    There is no way you cant access files using your browser , JavaScript is a view language its interact only with the browser, to be able to access local file you need to use a back end platform such as NodeJs or Php

    0 讨论(0)
  • 2021-01-29 15:59

    This wont work because your browser does not have access to your file system.

    you can run this from a node.js server

    see https://en.wikipedia.org/wiki/JavaScript#Security

    0 讨论(0)
提交回复
热议问题