Need Javascript to create a file on the web server.

Jun 17, 2016

I am working for a call center company, and we have implemented a new web server (Microsoft web server 2008) in our company. The purpose of this server is to move all e-learning courses on the server and share the link with agents.

Earlier, I used javascript below to create a file (TXT and XlS) locally:


var fso = new ActiveXObject("Scripting.FileSystemObject");
var s = fso.OpenTextFile("\\Test.txt", 8, true, 0);
var player = GetPlayer();
var name = player.GetVar("TextEntry");
var email = player.GetVar("TextEntry1");
s.Write(" " + email);
s.WriteLine(" " + name);
s.WriteLine("==========");
s.Close();

However, I cannot use the same code anymore as all my courses hosted on a web server. I am looking for a javascript that performs the same function but this time, it creates a file on the web server.

1 Reply
Dave Cox

Hi Mohammad

Javascript is not designed to read or write local files when content is accessed from a web server for security reasons. I'm not sure what you are attempting to accomplish here. but javascript can read and write cookies, or you can write your information to the web server, assuming you have write permissions. If you files are on a web server, you may be able to use server side scripting to do what you want to do. PHP is an example of server side scripting.

This discussion is closed. You can start a new discussion or contact Articulate Support.