Dear Friend,
That is not possible in Java Script. You cannot do it and read the file file and write the file which is opened. Because
1. Java Script is a client Side program and the files you are looking for is in the remote server.
2. The file reader can read the file in a particular folder. When you ask the file to reader to read a particular file, you have to map the drive with the drive name or the partitiion name in Linux.
for egs : fileReader.read("D:/abc/abc.jsp");
and when it comes in the webpage, you have to read the file like
www.abc.com/abc/abc.jsp. So you have to put the mapping in the file reader.
3. Java Script to Database,you have to use CGI or AJAX for this
Please check the manual for File Streams for more details