将文件保存到选定目录(javascript) [英] Save files into selected directory (javascript)

查看:124
本文介绍了将文件保存到选定目录(javascript)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



你好!我的问题是关于javascript。

我想要
1.要求用户选择一个目录

2.然后将我的一堆文件写入其中(可能需要创建没有与用户交互的子目录


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

我该怎么做?我可以吗?

我是javascript的新手,我希望得到你的帮助。

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

PS。

我听说过能够通过保存文件对话框要求用户选择路径,然后将数据保存到所选文件,但我想问一个用户一次,用于选择目录,然后在其中创建一堆文件,而不会为每个文件打扰一个用户。

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.

推荐答案

单独使用Javascript无法访问本地计算机的文件系统以进行WRITE。期间。

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

但是, Downloadify ,by Doug Neiner 是为此目的而构建的,它使用了Javascript和Flash库的组合。

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

它需要Flash 10才能工作。

It needs Flash 10 to work.

或者,你可以在计算机上安装apache(或者更好的是,像一个完整的堆栈一样XAMPP或WAMP / MAMP / LAMP)并使用PHP(使用javascript / ajax)将文件写入本地文件系统。但是,这意味着该网站也必须在本地托管。可能你最好的选择是 Downloadify

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

资源:

https://github.com/dcneiner/ Downloadify

如何使用jquery创建xml文件

使用Jquery保存内容?写入文件

使用AJAX保存到服务器端文件

这篇关于将文件保存到选定目录(javascript)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆