fbolavidez Posted September 11, 2007 Share Posted September 11, 2007 Hi everyone!I need help...my problem is how can i read the content of the text files using stream tokenizer in javascript or how can i call a file in a jsp page?thanks in advance..hope you wanna help me... :-).. good day! Link to comment Share on other sites More sharing options...
justsomeguy Posted September 11, 2007 Share Posted September 11, 2007 I don't think Javascript has a string tokenizer built-in. What code are you using? Also, which text files are *the* text files? Link to comment Share on other sites More sharing options...
fbolavidez Posted September 13, 2007 Author Share Posted September 13, 2007 I don't think Javascript has a string tokenizer built-in. What code are you using? Also, which text files are *the* text files?Good Day!Thanks for your reply.here is my code:function validateBinType(objRow){ alert('Page is loaded!') var filename = '<%= filename %>' // i got this in my readFile.jsp page myFileSysObj = new ActiveXObject("Scripting.FileSystemObject"); file = myFileSysObj.GetFile(filename); var myInputTextStream = myFileSysObj.OpenTextFile(file, 1, true); var myOutputTextStream = myFileSysObj.OpenTextFile(file, 2, true); while(!myInputTextStream.AtEndOfStream) { file = myOutputTextStream.Write(myInputTextStream.ReadAll()); if(file.value == 0)//if the content of the file contains 0... { rowColor = 'red'; } else if(file.value == 0) { rowColor = 'green'; } objRow.bgColor = rowColor; } myInputTextStream.Close(); myOutputTextStream.Close(); }...and this is my index.jsp page<HTML><HEAD></HEAD><BODY bgcolor="#33b9ec><H2 align="center"> Strip Map Reader</H2><FORM METHOD="POST" ACTION="readFile.jsp" name="formName"> <TABLE align="center" border="1" bgcolor="#2b6095" cellspacing="10" cellpadding="4"> <TR> <TD><font color="white">Please specify a file, or a set of files: <br> <INPUT TYPE="File" SIZE=40 NAME="textFileName" style="background: white;"> </TD> </TR> <tr> <td> <center> <INPUT TYPE=submit VALUE="Upload" style="width: 70px"> <INPUT TYPE=reset VALUE="Reset" style="width: 70px"> </center> </td> </tr> </TABLE> </FORM></BODY></HTML> i want to get or read the content of text file(e.g. sample.txt) uploaded in jsp page using javascript..how can i do that? Link to comment Share on other sites More sharing options...
justsomeguy Posted September 13, 2007 Share Posted September 13, 2007 Javascript alone can't access a file on disk, either on the server or the client. You need to use server-side code to access the files on the server, and you can't access the files on the client. Link to comment Share on other sites More sharing options...
fbolavidez Posted September 17, 2007 Author Share Posted September 17, 2007 Javascript alone can't access a file on disk, either on the server or the client. You need to use server-side code to access the files on the server, and you can't access the files on the client.Good Day!What will i do to access the files either on the server or client? can u give me a sample code....? thanks!:-) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.