Tuesday, April 11, 2006
You're Kidding, Aren't You?
As the interweb is currently arranged it is almost impossible to do what I want to do. But if you're running Windows and Internet Explorer, it can be done. You have to use an ActiveXObject and do something like this:
var fname = "theFileName.txt";Once you've done that you can, behind the User's back do the AJAX thing and send the contents of the file to the server from which the page was accessed. There are other methods that will open binary files.
var fso = new ActiveXObject("Scripting.FileSystemObject");
var theFile = fso.OpenTextFile(fname, 1, true);
var fileContents = theFile.readAll();
To reiterate, if I can guess the name of a file on your system, if you're running Windows and use IE to access a page on my webserver, I can, if you have JavaScript turned on, slurp the contents of said guessed file up onto my system and the only way you'll know it happened is if you have a packet sniffer running on your internets connection.
That's fucking insane.