How can I iterate through files in Javascript

前端 未结 4 1888
小蘑菇
小蘑菇 2021-01-21 05:08

Is it possible to iterate through a collection of files in Javascript? I am writing a jQuery plugin that takes either an array of images or, I was hoping, a directory containin

4条回答
  •  误落风尘
    2021-01-21 05:51

    If the directory is on the same domain, and your webserver is setup to show directory indexes, then you could use javascript to request the url and load it into the dom for data extraction. This is brittle, and doesn't sound like it would make for a good plugin, much less good for anything but a one off task. But, you could do it.

    The other suggestions of having serverside script output json or xml would be an improvement.

提交回复
热议问题