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:

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.

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.