473,806 Members | 2,605 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

from form to .csv file to webpage help req.

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","n ews title","news article"
"171003","o lder 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
14 5436
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_S PAM.ch> wrote in
message news:bm******** **@rex.ip-plus.net...
Hi,

StumpY wrote:
Hi Laurent,

a small example would be absolutely blinding :)

Cheers for your help

Stumpy


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

HTH,

Laurent

----------------------------
<%@Language=Jav aScript %>

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

<%

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

var fso = Server.CreateOb ject( "Scripting.File SystemObject" );

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

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

while ( !fl.AtEndOfStre am )
{
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 #11
Hi,

StumpY wrote:
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


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
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_S PAM.ch> wrote in
message news:3f******** **@news.bluewin .ch...
Hi,

StumpY wrote:
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


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 #13
Hi,

StumpY wrote:
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


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
Hi Laurent,
just got the following from my ISP - any help?

Cheers,

StumpY

FileSystemObjec t

Description

Provides access to a computer's file system.

Syntax

Scripting.FileS ystemObject

Remarks

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

Set fs = CreateObject("S cripting.FileSy stemObject")
Set a = fs.CreateTextFi le("c:\testfile .txt", True)
a.WriteLine("Th is is a test.")
a.Close

In the code shown above, the CreateObject function returns the
FileSystemObjec t (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_S PAM.ch> wrote in
message news:3f******** **@news.bluewin .ch...
Hi,

StumpY wrote:
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


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 #15

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
6147
by: Pete..... | last post by:
Hi all. I have made a webpage where there is a webform where people can fill in their personel information: The code is below: I want to transfer the data to a postgreSQL database ( I have allready made the database with the neccesary tables, and I know how to connect to it ) but I really have no idea how I can transfer the data from the webform to
5
5722
by: NK | last post by:
Hi, We have a webpage that has a form available on the intranet. A user will have a window open that runs a different application open. When the user accesses the webpage and clicks a button we should capture the data from the application window and populate the form. Is it possible to access text inside another opened window on the client pc, using javascript?
1
8045
by: teknowbabble | last post by:
I would like to know how to convert HTML code that users input into a TEXTAREA box on a HTML FORM into a separate WEBPAGE. I have something like the diagram below on my webpage. The user is prompted to input his/her HTML Code in the FORM TEXTAREA. By pushing the Make Webpage Button, a new window opens with the output of the HTML contents they inputted. This way people can see what their HTML looks like. HTML FORM TEXTAREA (Where user...
6
11305
by: martin | last post by:
Hi, I am a web page and a web user control. My web user control is placed in my web page using the following directive <%@ Register TagPrefix="uc1" TagName="Header" Src="WebControls/Header.ascx" %> The web user control contains the following server controls
5
18312
by: John Bradley | last post by:
Toooo tired to look this one up. I have data that I need to acces in a small program. The data is accessable from an ASP webpage that I created myself. If I need to see data from record #25, I just open http://mydomain.com/datapage.asp?recnum=25. I would like to read this data directly into a variable. I'm sure this is quite easy (as easy as Fileopen), but I just can't seem to find it.
10
23404
by: sanou | last post by:
Hi does anyone know if the following is possible? I have an excel spreadsheet with values that i need transferred to a certain website's form. for instance, i have a value in excel spreadsheet xyz that i wanted to transfer to a data entry box on a webpage that is concurrently open. basically i want to make it simple enough that at a push of a button, i can copy/paste all my data into another form. alternatively, i guess could have a...
6
2880
by: shivavrata | last post by:
Hi All, I want to transfer the data form webpage to any other own application which is running in backend.How i develop this web page. which technology is good for this or any particular protocol i have to use for this. Please suggest if any idea regarding data transfer. Thanks Shiva Vrata Anand
5
2758
by: Orv | last post by:
I have a database set up where I want to export the records to a cd. I want to be able to create an autorun cd and have it based on HTML so when it opens, the user can click on various links and it will show them the corresponding record. Any ideas? A template or merge would be great as not all the records from the DB would be going on the CD. TIA,
0
9719
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9598
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10371
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10373
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10111
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9192
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7650
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
2
3852
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3010
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.