Foreach file in directory jQuery

前端 未结 4 1369
南方客
南方客 2020-12-21 13:09

How can I do a foreach(File file in Directory) kind of thing in jQuery.

Thank you!

4条回答
  •  太阳男子
    2020-12-21 13:59

    It is not possible with javascript/jquery to read contents of a directory for security reasons. Imagine you are trying to read the file system of client machine. You can use FSO (File System Object) but that works only in IE. You can use server-side languages such as PHP, ASP.Net for accessing the file system.

    If you meant a loop with each, consider the each method of though. Example:

    $('selector').each(function(){
      // your code.....
    });
    

提交回复
热议问题