Write a File with JS

I want to write into a plain text file using JavaScript (client side),
how i can do that? Any idea could be good, but a sample could be
better. grettings :smiley:

On Tue, 2009-06-16 at 10:28 -0700, GGC wrote:

I want to write into a plain text file using JavaScript (client side),

Javascripts do not get access to the local file system. Security. Send
the data to the server and write the file there. Google ‘javascript
http post’ for explanation / code.

HTH,
Bill

You could do this using an ActiveX object, I think.

So something like:

var path = “C:\dir\file.txt”
var filesystemobject = new ActiveXObject("Scripting.FileSystemObject
var file = filesystemobject.CreateTextFile(path, true)

// your file manipulations

file.Close()

You might want to look into ActiveXObjects though. I think most
systems won’t allow you to write to a local path as Bill suggests.

bill walton wrote:

On Tue, 2009-06-16 at 10:48 -0700, jhaagmans wrote:

You could do this using an ActiveX object, I think.

This is a Ruby on Rails forum. Is there a way to use ActiveX objects in
RoR?

There would almost have to be – my understanding is that they can be
embedded in Web pages rather like Flash…speaking of which, I have the
impression that Flash gets more access to the filesystem than JS, so
that might be worth investigating.

But ActiveX is probably a bad idea in any case. It limits your audience
to IE on Windows, and I understand there are serious security issues
with it (as if Windows didn’t already have enough security holes).

Thanks,
Bill

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

On Tue, 2009-06-16 at 10:48 -0700, jhaagmans wrote:

You could do this using an ActiveX object, I think.

This is a Ruby on Rails forum. Is there a way to use ActiveX objects in
RoR?

Thanks,
Bill

jhaagmans wrote:

You could do this using an ActiveX object, I think.

Which is exactly why ActiveX has been one of the most popular attack
vectors for hacking in the history of computing.