0

I have a database of JSON records, stored locally in a separate folder. What is the best way to list all of the files in that specific folder using only HTML5 and JavaScript, and store their name in an array for future parsing?

I'm looking for something that doesn't require user interaction, the script has to scan for files itself, and store its findings.

Fluffy
  • 857
  • 1
  • 9
  • 20
  • Well JavaScript on the clientside can not access the file system... – epascarello Nov 18 '16 at 14:57
  • Have you tried anything? Seems pretty straightforward to write a script in your language of choice that lists the files in a directory on the server and outputs the result as html in the public folder. – nvioli Nov 18 '16 at 14:59
  • @nvioli — The question says the language of choice is "HTML5 and JavaScript", implying JS but only when embedded in a webpage. That stops it being remotely straightforward because of the security restrictions such code operates under. – Quentin Nov 18 '16 at 15:05
  • @Quentin Yes, that's my problem. I don't know much about webdev and I can't run PHP on the target webserver. But I suppose this could be a workaround, I could write a ruby script that outputs a .js file declaring the array I need, and embed this into the webpage. Can this work? – Fluffy Nov 18 '16 at 15:09
  • 1
    @Fluffy yes that sounds promising. You need a server-side language to inspect the files present on the server. – nvioli Nov 18 '16 at 15:12

0 Answers0