By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,692 Members | 1,670 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,692 IT Pros & Developers. It's quick & easy.

Remote filesystemobject (2nd try)

P: n/a
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.FileSystemObject");
gift = y.opentextfile("gifts.csv",1);
x = document.write("<table>");

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

if (giftinfo.charAt(0)=="0") {
information = giftinfo.split(",");
x = document.write("<td>",information[4],"</td>");
x = document.write("<td>",information[5],"</td>");
x = document.write("<td>",information[9],"</td>");
x = document.write("</tr>");
}
}
while (!gift.AtEndOfStream);

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 filesystemobject 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?

Jul 23 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
VK
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.asp

Really easy and specially designed for cases like yours.

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


Jul 23 '05 #2

P: n/a
Thanks, I'll look into that.

"VK" <sc**********@yahoo.com> wrote in message
news:41*********************@news.freenet.de...
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.asp

Really easy and specially designed for cases like yours.

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

Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.