View Full Version : javascript read/write .txt files on the server

11-10-2004, 09:22 PM
is it possible to read, or write .txt files to the server?

it would also be useful to know how one would parse the txt file with js.

I have seen vbscript write a .js file, but i need a txt file, and i would prefer
to use javascript.

thanks a hundred billion

11-10-2004, 10:34 PM
Not with JavaScript. Server-side language such as PHP would do what you want.
JavaScript is client-side only... so the only actions which can be performed by JavaScript are limited to a person's browser..
in php it could be done like this:

$file = file_get_contents('path/to/file.txt');
//perform any parsing routines... $parsed_file
$f = fopen('path/to/file.txt', 'w');
fwrite($f, $parsed_file);