suresh_kamrushi Posted May 27, 2011 Share Posted May 27, 2011 How we can Read /Write file in Javascript? Thanks in Advance!! Quote 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 Quote Link to comment https://forums.phpfreaks.com/topic/237632-file-handling-in-js/#findComment-1221081 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.