Save files into selected directory (javascript)

情到浓时终转凉″ 提交于 2019-12-01 23:24:47

问题



Hello! My question is about javascript.
I want to
1. ask a user to select a directory
2. then write my bunch of files to it (probably with creating sub-directories) without interaction with user

How can I do this? And can I?
I am new in javascript and I hope for your help.

PS.
I've heard about ability to ask a user to select a path by save file dialog and then save data to selected file, but i want to ask a user once for selecting a directory and then create a bunch of files in it without bothering a user for each one.


回答1:


Javascript alone doesn't have any way to access the local computer's file system for WRITE purposes. Period.

However, Downloadify, by Doug Neiner, was built for this purpose and uses a combination of Javascript and the Flash library.

It needs Flash 10 to work.

Alternately, you can install apache onto the computer (or better yet, a full stack like XAMPP or WAMP/MAMP/LAMP) and use PHP (with javascript/ajax) to write files onto the local file system. However, this means that the website must also be hosted locally. Probably your best bet is Downloadify

Resources:

https://github.com/dcneiner/Downloadify

How to create xml file with jquery

Save content using Jquery? Write to file


Saving to server-side file using AJAX



来源:https://stackoverflow.com/questions/20888867/save-files-into-selected-directory-javascript

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