Information Technology Solutions, Answers and Experts
Write an Article Ask a Question

from form to .csv file to webpage help req.

StumpY
P: n/a
StumpY
HI,
I have set up a page with a form which appends data to a .csv file on my asp
server, this is to enable a limited number of users to add news threads to
this file, which contains the data in the following format
(date,headline,article);
"181003","news title","news article"
"171003","older news title","news article"
The form adds the data in reverse chronological order with newest at the top
of the list.
Now I wish to be able to write the contents of the csv file to a table cell,
formatted the same as the rest of the page (if I use the include tag I get
unformatted text and all the speach marks and no paragraph tag in between
items).
I am new to javascript and asp, although I do have a basic understanding of
how they work.
Could someone kindly explain the best way to achieve this, I'm not looking
for someone to do my hard work for me nessacerely, if it isn't possible to
show me the coding needed, just an explanation will help greatly.
Many thanks in advance
StumpY


Jul 20 '05 #1

14 Replies



Fox
P: n/a
Fox

re: from form to .csv file to webpage help req.



StumpY wrote:[color=blue]
>
> HI,
> I have set up a page with a form which appends data to a .csv file on my asp
> server, this is to enable a limited number of users to add news threads to
> this file, which contains the data in the following format
> (date,headline,article);
> "181003","news title","news article"
> "171003","older news title","news article"
> The form adds the data in reverse chronological order with newest at the top
> of the list.
> Now I wish to be able to write the contents of the csv file to a table cell,
> formatted the same as the rest of the page (if I use the include tag I get
> unformatted text and all the speach marks and no paragraph tag in between
> items).
> I am new to javascript and asp, although I do have a basic understanding of
> how they work.
> Could someone kindly explain the best way to achieve this, I'm not looking
> for someone to do my hard work for me nessacerely, if it isn't possible to
> show me the coding needed, just an explanation will help greatly.
> Many thanks in advance
> StumpY[/color]

http://groups.google.com/groups?hl=e...tel.net&rnum=9
Jul 20 '05 #2

StumpY
P: n/a
StumpY

re: from form to .csv file to webpage help req.

N1 - is there any way to automate this procedure? I want my users to have
as little 'access' to the site as possible.
Cheers for the reply

"Fox" <fox@fxmahoney.com> wrote in message
news:3F91ED96.F470B72C@fxmahoney.com...[color=blue]
>
>
> StumpY wrote:[color=green]
> >
> > HI,
> > I have set up a page with a form which appends data to a .csv file on my[/color][/color]
asp[color=blue][color=green]
> > server, this is to enable a limited number of users to add news threads[/color][/color]
to[color=blue][color=green]
> > this file, which contains the data in the following format
> > (date,headline,article);
> > "181003","news title","news article"
> > "171003","older news title","news article"
> > The form adds the data in reverse chronological order with newest at the[/color][/color]
top[color=blue][color=green]
> > of the list.
> > Now I wish to be able to write the contents of the csv file to a table[/color][/color]
cell,[color=blue][color=green]
> > formatted the same as the rest of the page (if I use the include tag I[/color][/color]
get[color=blue][color=green]
> > unformatted text and all the speach marks and no paragraph tag in[/color][/color]
between[color=blue][color=green]
> > items).
> > I am new to javascript and asp, although I do have a basic understanding[/color][/color]
of[color=blue][color=green]
> > how they work.
> > Could someone kindly explain the best way to achieve this, I'm not[/color][/color]
looking[color=blue][color=green]
> > for someone to do my hard work for me nessacerely, if it isn't possible[/color][/color]
to[color=blue][color=green]
> > show me the coding needed, just an explanation will help greatly.
> > Many thanks in advance
> > StumpY[/color]
>
>[/color]
http://groups.google.com/groups?hl=e...tel.net&rnum=9


Jul 20 '05 #3

Laurent Bugnion, GalaSoft
P: n/a
Laurent Bugnion, GalaSoft

re: from form to .csv file to webpage help req.

Hi,

StumpY wrote:
[color=blue]
> N1 - is there any way to automate this procedure? I want my users to have
> as little 'access' to the site as possible.
> Cheers for the reply
>
> "Fox" <fox@fxmahoney.com> wrote in message
> news:3F91ED96.F470B72C@fxmahoney.com...
>[color=green]
>>
>>StumpY wrote:
>>[color=darkred]
>>>HI,
>>>I have set up a page with a form which appends data to a .csv file on my[/color][/color]
>
> asp
>[color=green][color=darkred]
>>>server, this is to enable a limited number of users to add news threads[/color][/color]
>
> to
>[color=green][color=darkred]
>>>this file, which contains the data in the following format
>>>(date,headline,article);
>>>"181003","news title","news article"
>>>"171003","older news title","news article"
>>>The form adds the data in reverse chronological order with newest at the[/color][/color]
>
> top
>[color=green][color=darkred]
>>>of the list.
>>>Now I wish to be able to write the contents of the csv file to a table[/color][/color]
>
> cell,
>[color=green][color=darkred]
>>>formatted the same as the rest of the page (if I use the include tag I[/color][/color]
>
> get
>[color=green][color=darkred]
>>>unformatted text and all the speach marks and no paragraph tag in[/color][/color]
>
> between
>[color=green][color=darkred]
>>>items).
>>>I am new to javascript and asp, although I do have a basic understanding[/color][/color]
>
> of
>[color=green][color=darkred]
>>>how they work.
>>>Could someone kindly explain the best way to achieve this, I'm not[/color][/color]
>
> looking
>[color=green][color=darkred]
>>>for someone to do my hard work for me nessacerely, if it isn't possible[/color][/color]
>
> to
>[color=green][color=darkred]
>>>show me the coding needed, just an explanation will help greatly.
>>>Many thanks in advance
>>>StumpY[/color]
>>
>>[/color]
> http://groups.google.com/groups?hl=e...tel.net&rnum=9[/color]

Fox didn't see that you have ASP, so what you're looking for is a
server-side solution.

On ASP, the procedure would be to:

1) Load the text file, using the FileSystemObject.
2) For each line, split the line in fields in a JavaScript array, using
the method strLine.split( "," ); where strLine is the line read form the
text file.
3) Build your table using the array's fields in a string.
4) Pass the built string in the Response object, like:
Response.Write( strHtml );

If you have troubles implementing this, ask me and I can provide you
with a small example.

HTH,

Laurent
--
Laurent Bugnion, GalaSoft
Webdesign, Java, javascript: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch

Jul 20 '05 #4

Fox
P: n/a
Fox

re: from form to .csv file to webpage help req.



StumpY wrote:[color=blue]
>
> N1 - is there any way to automate this procedure? I want my users to have
> as little 'access' to the site as possible.
> Cheers for the reply[/color]

The following is OffTopic

Use PHP -- it has a function specifically designed to read csv files.

<?php

// need to get how many records in file
// if your data file uses column labels
// remember to "burn off" the first record!
// this example ASSUMES your csv looks like:

// date,headline,article => column labels
// "181003","news title","news article"
// "171003","older news title","news article"


function
getNumRecords($h)
{
$cnt = -1; // discount column label row
// otherwise $cnt = 0;

while(fgetcsv($h, 10000)) $cnt++;
rewind($h); // reset file pointer to beginning
return $cnt;
}

$handle = fopen("myNews.csv","r");

$cnt = getNumRecords($handle);

echo "<script>\n\n";
echo "var newsdata = [\n\t\t";

fgetcsv($handle, 10000); // burn off labels

for($i = 0; $i < $cnt; $i++)
{
$data = fgetcsv($handle, 10000);
$cols = count($data);
echo "[";

for($j = 0; $j < $cols; $j++)
echo "\"" . $data[$j] . "\"" . ($j < $cols-1 ? "," : "");

echo "]" . ($i < $cnt - 1 ? "," : "") . "\n\t\t";
}

echo "];\n\n";
echo "</script>";

?>


The output from this will look like:

<script>

var newsdata = [
["181003","news title","news article"],
["171003","older news title","news aritcle"]
];


</script>


This PHP script does basically the same thing as the form routine I
linked you to.

The function fgetcsv takes care of stripping the quotes from "cell"
entries containing commas and the number of entries is correctly
returned -- no special handling should be needed [I'm not sure what
happens with quotes used in the data -- you'll probably need to
experiment with that [but I wouldn't be surprised if the function took
care of escaping it for you].

The arguments to fgetcsv are (obviously) the reference returned from
fopen and the *length* of the line to be returned -- note, the length
MUST be greater than the total number of characters in the longest line
within the file if you expect to retrieve all your data.






[color=blue]
>
> "Fox" <fox@fxmahoney.com> wrote in message
> news:3F91ED96.F470B72C@fxmahoney.com...[color=green]
> >
> >
> > StumpY wrote:[color=darkred]
> > >
> > > HI,
> > > I have set up a page with a form which appends data to a .csv file on my[/color][/color]
> asp[color=green][color=darkred]
> > > server, this is to enable a limited number of users to add news threads[/color][/color]
> to[color=green][color=darkred]
> > > this file, which contains the data in the following format
> > > (date,headline,article);
> > > "181003","news title","news article"
> > > "171003","older news title","news article"
> > > The form adds the data in reverse chronological order with newest at the[/color][/color]
> top[color=green][color=darkred]
> > > of the list.
> > > Now I wish to be able to write the contents of the csv file to a table[/color][/color]
> cell,[color=green][color=darkred]
> > > formatted the same as the rest of the page (if I use the include tag I[/color][/color]
> get[color=green][color=darkred]
> > > unformatted text and all the speach marks and no paragraph tag in[/color][/color]
> between[color=green][color=darkred]
> > > items).
> > > I am new to javascript and asp, although I do have a basic understanding[/color][/color]
> of[color=green][color=darkred]
> > > how they work.
> > > Could someone kindly explain the best way to achieve this, I'm not[/color][/color]
> looking[color=green][color=darkred]
> > > for someone to do my hard work for me nessacerely, if it isn't possible[/color][/color]
> to[color=green][color=darkred]
> > > show me the coding needed, just an explanation will help greatly.
> > > Many thanks in advance
> > > StumpY[/color]
> >
> >[/color]
> http://groups.google.com/groups?hl=e...tel.net&rnum=9[/color]
Jul 20 '05 #5

StumpY
P: n/a
StumpY

re: from form to .csv file to webpage help req.

Cheers Fox - but I've got no PHP feature available (MS Hosting)
Stumpy
"Fox" <fox@fxmahoney.com> wrote in message
news:3F925728.1999C6F@fxmahoney.com...[color=blue]
>
>
> StumpY wrote:[color=green]
> >
> > N1 - is there any way to automate this procedure? I want my users to[/color][/color]
have[color=blue][color=green]
> > as little 'access' to the site as possible.
> > Cheers for the reply[/color]
>
> The following is OffTopic
>
> Use PHP -- it has a function specifically designed to read csv files.
>
> <?php
>
> // need to get how many records in file
> // if your data file uses column labels
> // remember to "burn off" the first record!
> // this example ASSUMES your csv looks like:
>
> // date,headline,article => column labels
> // "181003","news title","news article"
> // "171003","older news title","news article"
>
>
> function
> getNumRecords($h)
> {
> $cnt = -1; // discount column label row
> // otherwise $cnt = 0;
>
> while(fgetcsv($h, 10000)) $cnt++;
> rewind($h); // reset file pointer to beginning
> return $cnt;
> }
>
> $handle = fopen("myNews.csv","r");
>
> $cnt = getNumRecords($handle);
>
> echo "<script>\n\n";
> echo "var newsdata = [\n\t\t";
>
> fgetcsv($handle, 10000); // burn off labels
>
> for($i = 0; $i < $cnt; $i++)
> {
> $data = fgetcsv($handle, 10000);
> $cols = count($data);
> echo "[";
>
> for($j = 0; $j < $cols; $j++)
> echo "\"" . $data[$j] . "\"" . ($j < $cols-1 ? "," : "");
>
> echo "]" . ($i < $cnt - 1 ? "," : "") . "\n\t\t";
> }
>
> echo "];\n\n";
> echo "</script>";
>
> ?>
>
>
> The output from this will look like:
>
> <script>
>
> var newsdata = [
> ["181003","news title","news article"],
> ["171003","older news title","news aritcle"]
> ];
>
>
> </script>
>
>
> This PHP script does basically the same thing as the form routine I
> linked you to.
>
> The function fgetcsv takes care of stripping the quotes from "cell"
> entries containing commas and the number of entries is correctly
> returned -- no special handling should be needed [I'm not sure what
> happens with quotes used in the data -- you'll probably need to
> experiment with that [but I wouldn't be surprised if the function took
> care of escaping it for you].
>
> The arguments to fgetcsv are (obviously) the reference returned from
> fopen and the *length* of the line to be returned -- note, the length
> MUST be greater than the total number of characters in the longest line
> within the file if you expect to retrieve all your data.
>
>
>
>
>
>
>[color=green]
> >
> > "Fox" <fox@fxmahoney.com> wrote in message
> > news:3F91ED96.F470B72C@fxmahoney.com...[color=darkred]
> > >
> > >
> > > StumpY wrote:
> > > >
> > > > HI,
> > > > I have set up a page with a form which appends data to a .csv file[/color][/color][/color]
on my[color=blue][color=green]
> > asp[color=darkred]
> > > > server, this is to enable a limited number of users to add news[/color][/color][/color]
threads[color=blue][color=green]
> > to[color=darkred]
> > > > this file, which contains the data in the following format
> > > > (date,headline,article);
> > > > "181003","news title","news article"
> > > > "171003","older news title","news article"
> > > > The form adds the data in reverse chronological order with newest at[/color][/color][/color]
the[color=blue][color=green]
> > top[color=darkred]
> > > > of the list.
> > > > Now I wish to be able to write the contents of the csv file to a[/color][/color][/color]
table[color=blue][color=green]
> > cell,[color=darkred]
> > > > formatted the same as the rest of the page (if I use the include tag[/color][/color][/color]
I[color=blue][color=green]
> > get[color=darkred]
> > > > unformatted text and all the speach marks and no paragraph tag in[/color]
> > between[color=darkred]
> > > > items).
> > > > I am new to javascript and asp, although I do have a basic[/color][/color][/color]
understanding[color=blue][color=green]
> > of[color=darkred]
> > > > how they work.
> > > > Could someone kindly explain the best way to achieve this, I'm not[/color]
> > looking[color=darkred]
> > > > for someone to do my hard work for me nessacerely, if it isn't[/color][/color][/color]
possible[color=blue][color=green]
> > to[color=darkred]
> > > > show me the coding needed, just an explanation will help greatly.
> > > > Many thanks in advance
> > > > StumpY
> > >
> > >[/color]
> >[/color][/color]
http://groups.google.com/groups?hl=e...tel.net&rnum=9


Jul 20 '05 #6

StumpY
P: n/a
StumpY

re: from form to .csv file to webpage help req.

Hi Laurent,

a small example would be absolutely blinding :)

Cheers for your help

Stumpy

"Laurent Bugnion, GalaSoft" <galasoft-LB@bluewin_NO_SPAM.ch> wrote in
message news:3f92479e_3@news.bluewin.ch...[color=blue]
> Hi,
>
> StumpY wrote:
>[color=green]
> > N1 - is there any way to automate this procedure? I want my users to[/color][/color]
have[color=blue][color=green]
> > as little 'access' to the site as possible.
> > Cheers for the reply
> >
> > "Fox" <fox@fxmahoney.com> wrote in message
> > news:3F91ED96.F470B72C@fxmahoney.com...
> >[color=darkred]
> >>
> >>StumpY wrote:
> >>
> >>>HI,
> >>>I have set up a page with a form which appends data to a .csv file on[/color][/color][/color]
my[color=blue][color=green]
> >
> > asp
> >[color=darkred]
> >>>server, this is to enable a limited number of users to add news threads[/color]
> >
> > to
> >[color=darkred]
> >>>this file, which contains the data in the following format
> >>>(date,headline,article);
> >>>"181003","news title","news article"
> >>>"171003","older news title","news article"
> >>>The form adds the data in reverse chronological order with newest at[/color][/color][/color]
the[color=blue][color=green]
> >
> > top
> >[color=darkred]
> >>>of the list.
> >>>Now I wish to be able to write the contents of the csv file to a table[/color]
> >
> > cell,
> >[color=darkred]
> >>>formatted the same as the rest of the page (if I use the include tag I[/color]
> >
> > get
> >[color=darkred]
> >>>unformatted text and all the speach marks and no paragraph tag in[/color]
> >
> > between
> >[color=darkred]
> >>>items).
> >>>I am new to javascript and asp, although I do have a basic[/color][/color][/color]
understanding[color=blue][color=green]
> >
> > of
> >[color=darkred]
> >>>how they work.
> >>>Could someone kindly explain the best way to achieve this, I'm not[/color]
> >
> > looking
> >[color=darkred]
> >>>for someone to do my hard work for me nessacerely, if it isn't possible[/color]
> >
> > to
> >[color=darkred]
> >>>show me the coding needed, just an explanation will help greatly.
> >>>Many thanks in advance
> >>>StumpY
> >>
> >>[/color]
> >[/color][/color]
http://groups.google.com/groups?hl=e...tel.net&rnum=9[color=blue]
>
> Fox didn't see that you have ASP, so what you're looking for is a
> server-side solution.
>
> On ASP, the procedure would be to:
>
> 1) Load the text file, using the FileSystemObject.
> 2) For each line, split the line in fields in a JavaScript array, using
> the method strLine.split( "," ); where strLine is the line read form the
> text file.
> 3) Build your table using the array's fields in a string.
> 4) Pass the built string in the Response object, like:
> Response.Write( strHtml );
>
> If you have troubles implementing this, ask me and I can provide you
> with a small example.
>
> HTH,
>
> Laurent
> --
> Laurent Bugnion, GalaSoft
> Webdesign, Java, javascript: http://www.galasoft-LB.ch
> Private/Malaysia: http://mypage.bluewin.ch/lbugnion
> Support children in Calcutta: http://www.calcutta-espoir.ch
>[/color]


Jul 20 '05 #7

Laurent Bugnion, GalaSoft
P: n/a
Laurent Bugnion, GalaSoft

re: from form to .csv file to webpage help req.

Hi,

StumpY wrote:
[color=blue]
> Hi Laurent,
>
> a small example would be absolutely blinding :)
>
> Cheers for your help
>
> Stumpy[/color]

Here is a very simple example. You can modify the table layout in the
line 24 and following.

HTH,

Laurent

----------------------------
<%@Language=JavaScript %>

<HTML>
<HEAD>
<TITLE>GalaSoft</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">

<%

var NAME_CSV_FILE = "d:\\temp\\test.txt";

var fso = Server.CreateObject( "Scripting.FileSystemObject" );

if ( !fso.FileExists( NAME_CSV_FILE ) )
{
Response.Write( "The file doesn't exist" );
}
else
{
// 1 = ForReading
var fl = fso.OpenTextFile( NAME_CSV_FILE, 1 );

var strTable = "<TABLE BORDER='1'>\n";

while ( !fl.AtEndOfStream )
{
var strLine = fl.ReadLine();
var astrLine = strLine.split( ',' );

// Remove "" from fields
var strDate
= astrLine[0].substring( 1, astrLine[0].length - 1 );
var strTitle
= astrLine[1].substring( 1, astrLine[1].length - 1 );
var strArticle
= astrLine[2].substring( 1, astrLine[2].length - 1 );

var strTableRow = "<TR>\n"
+ "<TD>" + strDate + "</TD>\n"
+ "<TD>" + strTitle + "</TD>\n"
+ "<TD>" + strArticle + "</TD>\n"
+ "</TR>\n";

strTable += strTableRow;
}

strTable += "</TABLE>\n";

Response.Write( strTable );
}

%>

</BODY>
</HTML>

--
Laurent Bugnion, GalaSoft
Webdesign, Java, javascript: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch

Jul 20 '05 #8

Laurent Bugnion, GalaSoft
P: n/a
Laurent Bugnion, GalaSoft

re: from form to .csv file to webpage help req.

Hi,

StumpY wrote:
[color=blue]
> Cheers Fox - but I've got no PHP feature available (MS Hosting)
> Stumpy[/color]

You could install PHP on your host, solutions are available AFAIK.
However, if you have a MS host anyway, you're better off with ASP and
JScript.

Laurent
--
Laurent Bugnion, GalaSoft
Webdesign, Java, javascript: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch

Jul 20 '05 #9

StumpY
P: n/a
StumpY

re: from form to .csv file to webpage help req.

Thank you very much - a lifesaver!!

"Laurent Bugnion, GalaSoft" <galasoft-LB@bluewin_NO_SPAM.ch> wrote in
message news:bmvuv2$nm4$1@rex.ip-plus.net...[color=blue]
> Hi,
>
> StumpY wrote:
>[color=green]
> > Hi Laurent,
> >
> > a small example would be absolutely blinding :)
> >
> > Cheers for your help
> >
> > Stumpy[/color]
>
> Here is a very simple example. You can modify the table layout in the
> line 24 and following.
>
> HTH,
>
> Laurent
>
> ----------------------------
> <%@Language=JavaScript %>
>
> <HTML>
> <HEAD>
> <TITLE>GalaSoft</TITLE>
> </HEAD>
> <BODY BGCOLOR="#FFFFFF">
>
> <%
>
> var NAME_CSV_FILE = "d:\\temp\\test.txt";
>
> var fso = Server.CreateObject( "Scripting.FileSystemObject" );
>
> if ( !fso.FileExists( NAME_CSV_FILE ) )
> {
> Response.Write( "The file doesn't exist" );
> }
> else
> {
> // 1 = ForReading
> var fl = fso.OpenTextFile( NAME_CSV_FILE, 1 );
>
> var strTable = "<TABLE BORDER='1'>\n";
>
> while ( !fl.AtEndOfStream )
> {
> var strLine = fl.ReadLine();
> var astrLine = strLine.split( ',' );
>
> // Remove "" from fields
> var strDate
> = astrLine[0].substring( 1, astrLine[0].length - 1 );
> var strTitle
> = astrLine[1].substring( 1, astrLine[1].length - 1 );
> var strArticle
> = astrLine[2].substring( 1, astrLine[2].length - 1 );
>
> var strTableRow = "<TR>\n"
> + "<TD>" + strDate + "</TD>\n"
> + "<TD>" + strTitle + "</TD>\n"
> + "<TD>" + strArticle + "</TD>\n"
> + "</TR>\n";
>
> strTable += strTableRow;
> }
>
> strTable += "</TABLE>\n";
>
> Response.Write( strTable );
> }
>
> %>
>
> </BODY>
> </HTML>
>
> --
> Laurent Bugnion, GalaSoft
> Webdesign, Java, javascript: http://www.galasoft-LB.ch
> Private/Malaysia: http://mypage.bluewin.ch/lbugnion
> Support children in Calcutta: http://www.calcutta-espoir.ch
>[/color]


Jul 20 '05 #10

StumpY
P: n/a
StumpY

re: from form to .csv file to webpage help req.

Lauren
I get a "The page cannot be displayed" (HTTP500) error - I am running this
on my ISP server if that makes a difference?
All I have altered is to replace "d:\\temp\\test.txt" with "text.asp" (all
files in the root of my webspace)

Stumpy

"Laurent Bugnion, GalaSoft" <galasoft-LB@bluewin_NO_SPAM.ch> wrote in
message news:bmvuv2$nm4$1@rex.ip-plus.net...[color=blue]
> Hi,
>
> StumpY wrote:
>[color=green]
> > Hi Laurent,
> >
> > a small example would be absolutely blinding :)
> >
> > Cheers for your help
> >
> > Stumpy[/color]
>
> Here is a very simple example. You can modify the table layout in the
> line 24 and following.
>
> HTH,
>
> Laurent
>
> ----------------------------
> <%@Language=JavaScript %>
>
> <HTML>
> <HEAD>
> <TITLE>GalaSoft</TITLE>
> </HEAD>
> <BODY BGCOLOR="#FFFFFF">
>
> <%
>
> var NAME_CSV_FILE = "d:\\temp\\test.txt";
>
> var fso = Server.CreateObject( "Scripting.FileSystemObject" );
>
> if ( !fso.FileExists( NAME_CSV_FILE ) )
> {
> Response.Write( "The file doesn't exist" );
> }
> else
> {
> // 1 = ForReading
> var fl = fso.OpenTextFile( NAME_CSV_FILE, 1 );
>
> var strTable = "<TABLE BORDER='1'>\n";
>
> while ( !fl.AtEndOfStream )
> {
> var strLine = fl.ReadLine();
> var astrLine = strLine.split( ',' );
>
> // Remove "" from fields
> var strDate
> = astrLine[0].substring( 1, astrLine[0].length - 1 );
> var strTitle
> = astrLine[1].substring( 1, astrLine[1].length - 1 );
> var strArticle
> = astrLine[2].substring( 1, astrLine[2].length - 1 );
>
> var strTableRow = "<TR>\n"
> + "<TD>" + strDate + "</TD>\n"
> + "<TD>" + strTitle + "</TD>\n"
> + "<TD>" + strArticle + "</TD>\n"
> + "</TR>\n";
>
> strTable += strTableRow;
> }
>
> strTable += "</TABLE>\n";
>
> Response.Write( strTable );
> }
>
> %>
>
> </BODY>
> </HTML>
>
> --
> Laurent Bugnion, GalaSoft
> Webdesign, Java, javascript: http://www.galasoft-LB.ch
> Private/Malaysia: http://mypage.bluewin.ch/lbugnion
> Support children in Calcutta: http://www.calcutta-espoir.ch
>[/color]


Jul 20 '05 #11

Laurent Bugnion, GalaSoft
P: n/a
Laurent Bugnion, GalaSoft

re: from form to .csv file to webpage help req.

Hi,

StumpY wrote:[color=blue]
> Lauren
> I get a "The page cannot be displayed" (HTTP500) error - I am running this
> on my ISP server if that makes a difference?
> All I have altered is to replace "d:\\temp\\test.txt" with "text.asp" (all
> files in the root of my webspace)
>
> Stumpy[/color]

Are you sure that your ISP supports ASP?

Laurent
--
Laurent Bugnion, GalaSoft
Webdesign, Java, javascript: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch

Jul 20 '05 #12

StumpY
P: n/a
StumpY

re: from form to .csv file to webpage help req.

Yep - would the server object be too much of a security risk to run on the
ISP server or is this a common practice?

Stumpy

"Laurent Bugnion, GalaSoft" <galasoft-LB@bluewin_NO_SPAM.ch> wrote in
message news:3f9411a0$1_3@news.bluewin.ch...[color=blue]
> Hi,
>
> StumpY wrote:[color=green]
> > Lauren
> > I get a "The page cannot be displayed" (HTTP500) error - I am running[/color][/color]
this[color=blue][color=green]
> > on my ISP server if that makes a difference?
> > All I have altered is to replace "d:\\temp\\test.txt" with "text.asp"[/color][/color]
(all[color=blue][color=green]
> > files in the root of my webspace)
> >
> > Stumpy[/color]
>
> Are you sure that your ISP supports ASP?
>
> Laurent
> --
> Laurent Bugnion, GalaSoft
> Webdesign, Java, javascript: http://www.galasoft-LB.ch
> Private/Malaysia: http://mypage.bluewin.ch/lbugnion
> Support children in Calcutta: http://www.calcutta-espoir.ch
>[/color]


Jul 20 '05 #13

Laurent Bugnion, GalaSoft
P: n/a
Laurent Bugnion, GalaSoft

re: from form to .csv file to webpage help req.

Hi,

StumpY wrote:
[color=blue]
> Yep - would the server object be too much of a security risk to run on the
> ISP server or is this a common practice?
>
> Stumpy[/color]

I suggest that you discuss this with your ISP. On Windows servers (on
others too), it's possible to set pretty much any security restriction
on files and directories. To get access to files, the server must be
registered as a user for the directory the file is in. Without feedback
from your ISP, it's pretty much a wild guess.

Laurent
--
Laurent Bugnion, GalaSoft
Webdesign, Java, javascript: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch

Jul 20 '05 #14

StumpY
P: n/a
StumpY

re: from form to .csv file to webpage help req.

Hi Laurent,
just got the following from my ISP - any help?

Cheers,

StumpY

FileSystemObject

Description

Provides access to a computer's file system.

Syntax

Scripting.FileSystemObject

Remarks

The following code illustrates how the FileSystemObject is used to
return a TextStream object that can be read from or written to:



Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile("c:\testfile.txt", True)
a.WriteLine("This is a test.")
a.Close



In the code shown above, the CreateObject function returns the
FileSystemObject (fs). The CreateTextFile method then creates the file as a
TextStream object (a), and the WriteLine method writes a line of text to the
created text file. The Close method flushes the buffer and closes the file.



"Laurent Bugnion, GalaSoft" <galasoft-LB@bluewin_NO_SPAM.ch> wrote in
message news:3f942482$1_2@news.bluewin.ch...[color=blue]
> Hi,
>
> StumpY wrote:
>[color=green]
> > Yep - would the server object be too much of a security risk to run on[/color][/color]
the[color=blue][color=green]
> > ISP server or is this a common practice?
> >
> > Stumpy[/color]
>
> I suggest that you discuss this with your ISP. On Windows servers (on
> others too), it's possible to set pretty much any security restriction
> on files and directories. To get access to files, the server must be
> registered as a user for the directory the file is in. Without feedback
> from your ISP, it's pretty much a wild guess.
>
> Laurent
> --
> Laurent Bugnion, GalaSoft
> Webdesign, Java, javascript: http://www.galasoft-LB.ch
> Private/Malaysia: http://mypage.bluewin.ch/lbugnion
> Support children in Calcutta: http://www.calcutta-espoir.ch
>[/color]


Jul 20 '05 #15

Post your reply

Sign in to post your reply or Sign up for a free account.



Didn't find the answer to your question? Post your JavaScript / Ajax / DHTML question on Bytes

You can also browse similar questions: JavaScript / Ajax / DHTML

Get JavaScript / Ajax / DHTML Help

Get JavaScript / Ajax / DHTML help from a network of professionals.

Post your Question » Over 331,212 Members | 3378 Online