Read remote directory with client-side javascript?

旧街凉风 提交于 2019-12-11 12:19:02

问题


I'd like to scan a directory on my server, using JS, and create a link to the most recent file in the dir.

My server doesn't disallow directory listings; I can see the contents of the folder if I navigate to it.

Is it possible to do this in straight JS?


回答1:


All Javascript can do is HTTP requests and read whatever your server responds with. If your server doesn't give you any sort of directory listing over HTTP, then there's very little you can do with Javascript. If it does give you a directory listing you could try to parse it, but you still can't create any files or links on the server purely with client-side Javascript. This really calls for a server-side solution (PHP, Python, Ruby, C#, shell scripts; whatever you're comfortable writing).



来源:https://stackoverflow.com/questions/35404637/read-remote-directory-with-client-side-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!