...

View Full Version : Loading a textfile into a textarea on server



lock
03-17-2005, 02:14 AM
Hello!

I have abit of a problem, which is:

I'm using a textarea inbedded into an html page, which allows users to load in text files, mainly HTML into that textarea, which is then converted and the user can save the file to their desktop.

At the moment, I'm using the following code:

function readFile (fileName) {
if (document.layers && navigator.javaEnabled()) {
netscape.security.PrivilegeManager.enablePrivilege('UniversalFileRead');
var bfr = new java.io.BufferedReader(new java.io.FileReader(fileName));
var line;
var content = '';
while ((line = bfr.readLine()) != null)
content += line + java.lang.System.getProperty('line.separator');
return content;
}
else if (document.all) {
var fso = new ActiveXObject('Scripting.FileSystemObject');
var fs = fso.OpenTextFile(fileName);
var result = fs.ReadAll();
return result;
}
}

This function uses an activeX control to load in the file.

I want to run the html page on a server, and still allow the user to be able to load a text file into the textarea.

However, I'm aware the above code won't work for this?

Can someone suggest a method by which I can? Unfortunatly the server I'm uploading to is not mine and I doubt the security settings can be changed because its on a very large network..

Thanks for any help in advance!

codegoboom
03-17-2005, 11:11 AM
The only client-side alternatives are IE Default Behaviors, namely "download", or some type of dataservice. These may be restricted for local files, however.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum