Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Feb 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Loading a textfile into a textarea on server

    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!

  • #2
    Regular Coder
    Join Date
    Aug 2004
    Location
    codegoboom@yahoo.com
    Posts
    999
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The only client-side alternatives are IE Default Behaviors, namely "download", or some type of dataservice. These may be restricted for local files, however.
    *this message will self destruct in n-seconds*


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •