suresh_kamrushi Posted May 27, 2011 Share Posted May 27, 2011 How we can Read /Write file in Javascript? Thanks in Advance!! Link to comment https://forums.phpfreaks.com/topic/237632-file-handling-in-js/ Share on other sites More sharing options...
dougjohnson Posted May 27, 2011 Share Posted May 27, 2011 I found these online..... // READ // fh = fopen(getScriptPath(), 0); if (fh!=-1) { length = flength(fh); str = fread(fh, length); fclose(fh); write(str); } // WRITE // function WriteFile() { var fh = fopen("c:\\MyFile.txt", 3); // Open the file for writing if (fh!=-1) { var str = "Some text goes here..."; fwrite(fh, str); fclose(fh); } } WriteFile(); Hope this helps Link to comment https://forums.phpfreaks.com/topic/237632-file-handling-in-js/#findComment-1221081 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.