Remote filesystemobject (2nd try)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Malcolm

    Remote filesystemobject (2nd try)

    I am a near total novice, trying to write some Javascript code that will
    display certain elements in a comma separated value file (gifts.csv) in
    tabular form when a page is loaded. I have come up with the following which
    works fine when I view the page in my coding tool (AceHTML 5 Pro). Basically
    it sets up an array, opens the csv file, reads each line from the file,
    decides whether the line needs processing and if so loads each value into an
    element of the array and writes some of them out. There are some table tags
    thrown into appropriate places.

    <script>

    information = new Array(10);
    y = new ActiveXObject(" Scripting.FileS ystemObject");
    gift = y.opentextfile( "gifts.csv" ,1);
    x = document.write( "<table>");

    do {
    x = document.write( "<tr>");
    giftinfo = gift.readline() ;

    if (giftinfo.charA t(0)=="0") {
    information = giftinfo.split( ",");
    x = document.write( "<td>",informat ion[4],"</td>");
    x = document.write( "<td>",informat ion[5],"</td>");
    x = document.write( "<td>",informat ion[9],"</td>");
    x = document.write( "</tr>");
    }
    }
    while (!gift.AtEndOfS tream);

    x = document.write( "</table>");

    </script>

    However it doesn't work from a server using IE. From what I've read I
    believe it is because the filesystemobjec t works with the local filesystem
    whereas the csv file is on the server.

    Is there any way of redoing this so that the file on the server is opened
    and read, or can I download the csv file onto the client machine so that it
    works as written, or do I need to be doing something with asp (is that
    right?) so the the scripting runs on the server not the client?

    Or am I asking the wrong questions?



  • VK

    #2
    Re: Remote filesystemobjec t (2nd try)

    Browser doesn't allow you to access local/remote file system this way for
    obvious security reasons.

    In your case I would suggest the data binding provided by IE.

    You may start from here:

    data_binding.as p

    Really easy and specially designed for cases like yours.

    If later for some reasons you decide to support NN, google for "data island"




    Comment

    • Malcolm

      #3
      Re: Remote filesystemobjec t (2nd try)

      Thanks, I'll look into that.

      "VK" <schools_ring@y ahoo.com> wrote in message
      news:4140a2ec$0 $190$9b622d9e@n ews.freenet.de. ..[color=blue]
      > Browser doesn't allow you to access local/remote file system this way for
      > obvious security reasons.
      >
      > In your case I would suggest the data binding provided by IE.
      >
      > You may start from here:
      > http://msdn.microsoft.com/library/de...thor/databind/
      > data_binding.as p
      >
      > Really easy and specially designed for cases like yours.
      >
      > If later for some reasons you decide to support NN, google for "data
      > island"[/color]


      Comment

      Working...