Is there a way to, with JavaScript, get a list of files from a target folder?
I need to search a folder for XML-files and, if there are any, save the names of them in an array.
Thank you!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No. JavaScript works only in the client. Without AJAX calls, JavaScript has no way of looking through folders on the server or on the client’s computer.
A language like PHP or Ruby has a part in the server that would allow it access to the file system on the server, but not plain JavaScript.
As sofrito notes below, HTML5 now has a File API which can be used to manipulate files. However, the API can’t do all the things that I listed above: Javascript still can’t look through folders on your computer or another person’s with the same ability as a C++, Java, Python or Ruby program.