I want to be able to open a plain text file in JAVASCRIPT and be able to read as text
I want to be able to open a plain text file in JAVASCRIPT and be able to read as text. .
I able to write text in .text file But i cant able to read or open file.here is javascript code...Please advice.
<script language="javascript" type="text/javascript">
var fso, ts;
var ForWriting= 2;
fso = new ActiveXObject("Scripting.FileSystemObject");
ts = fso.CreateTextFile("c:\\test.txt", 2, true,0);
ts.Close();
ts.write("ia javascript");
var ForReading = 1, openfile;
openfile = fso.OpenTextFile("c:\\test.txt", 1);
if(openfile =-1)
{
var obj = openfile.ReadAll();
//var obj = openfile.ReadLine();
Response.Write("File contents:" +obj);
}
</script>