读写本地文本文件 [英] read and write local text files
本文介绍了读写本地文本文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨!
我需要读取和写入用户提供的文本文件的内容。
想法有两种选择。
阅读:
-用户选择带有< input type ="文件的文件">
-使用javascript,阅读文件的内容并进行处理。
写:
- 建一个字符串并显示a另存为对话框保存到文本文件
我只需要它在Firefox中工作。
如果有帮助,我正在使用mootools。
任何人都可以帮助我吗?
thx提前
Hi!
I need to read and write the content of a text file given by the users.
The idea is to have two options.
Read:
-the user selects a file with a <input type="file">
-using javascript, read the content of the file and process it.
Write:
-build a string and display a "Save as dialog" to save to a text file
I just need it to work in Firefox.
I′m using mootools if it helps.
Can anyone help me?
thx in advance
推荐答案
JavaScript无法访问本地文件系统读/写本地文件。你需要一些服务器端代码才能上传文件然后读/写它。
JavaScript can''t access the local file system and read/write local files. You will need some server-side code to be able to upload the file and then read/write it.
那是一个无赖:(
但好的,现在的问题是如何使用ajax上传?
我想我已经在通行证中完成了它,但我不记得如何。
我必须使用iframe!?
Thx
That''s a bummer :(
But ok, now the question is how to upload using ajax?
I think I''ve done it in the pass, but I cant remember how.
I have to use a iframe !?
Thx
这里是一个例子。它仍然使用iframe。
Here''s one example. It still uses an iframe.
这篇关于读写本地文本文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文