Display the contents of a .txt file on a webpage


Recommended Posts

Not sure where this should be posted, Mods please move to proper place.

I need to find a way to take a .txt/.log file and

A) Upload it to a web server everytime the file changes (Preferably automatically)

B) Take that .txt/.log file once it is uploaded and display it's contents on a webpage (Refreshing everytime the uploaded file changes)

Thank you in advance for your help.

*note* for those of you that want to know why I would want to do such a thing...

I have a private Irc room that I would like to monitor from a mobile device like my PsP, unfortunately There is no easy way to use Irc via PsP (Without hacking the stock firmware) and I would like to avoid that if possible. there was a PsP Web portal at pspirc.com, but they shut down and it doesn't look like they will return, and ircatwork.com will not display properly on PsP.

Any other ways to do this, suggestions or the like are appreciated.

1) find software that monitors file changes, upon change have it execute ftp and upload it. (alternatively you could have it upload every half hour by scheduled task).

2) use the object tag to embed the text file in a web page.

<object data="http://www.ietf.org/rfc/rfc1459.txt" border="1" type="text/css" width="700" height="500">
</object>

edit:

And if you want to have it automatically refresh every X seconds:

<head>
<META HTTP-EQUIV="Refresh"
CONTENT="X; URL="thewebpage.html">;/head>

<body>
<object data="http://www.ietf.org/rfc/rfc1459.txt" border="1" type="text/css" width="700" height="500">
</object>
<br>
</body>

Edited by bigflavor

Thank you Big flavor for the response, only one thing remains..... The file is local and I have no clue how to put all of this info together, so I need a bit more help.

the .html file is in c:\program files\mirc\AC1 Logged.htm and the .txt/.log file is in c:\program files\mirc\#AC1.log

The "webserver" I have is Analog X Simpleserver pointed to c:\program files\mirc\AC1 Logged.htm as it's index file.

I can view the "page" via the Local network, but the text of the .log file is not appearing.

What do I need to do still???

Contents of AC1 Logged.htm Below

<html>

<head>

<meta name="GENERATOR" content="Microsoft FrontPage 5.0">

<meta name="ProgId" content="FrontPage.Editor.Document">

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

<META HTTP-EQUIV="Refresh"

CONTENT="30; URL="file:///c:\program files\mirc\AC1 Logged.html">

<title>#AC1 Logged</title>

</head>

<body>

<object data="file:///c:\program files\mirc\#AC1.log" border="1" type="text/css" width="700" height="500">

</object>

<br>

</body>

</html>

Thank you for your help.

OK, I have got it worked out...to a point.

&lt;html&gt;

&lt;head&gt;
&lt;META HTTP-EQUIV="Refresh"
CONTENT="30; URL=file:///c:/program files/mirc/AC1 Logged.htm"file:///c:\programs\mirc\index.htm">;title&gt;#AC1 Logged&lt;/title&gt;
&lt;base href="file:///c:\program files\mirc\index.htm" target="_self"&gt;
&lt;/head&gt;

&lt;body&gt;

&lt;p align="left"&gt;
&lt;IFRAME frameBorder=1 height=272 width=480 marginHeight=0 marginWidth=1 src="AC1.txt" name="AC1" scrolling="yes"&gt;
&lt;/IFRAME&gt;

&lt;/body&gt;

&lt;/html&gt;

I can display the .log/.txt file in an Iframe, now for the fun part.

The iframe will only display .txt files within itself, if I use a .log file it pops up in notepad outside of the web page.

is there any way to get the .log file in the iframe?

If not is there a program that can automatically convert .log to .txt at regular intervals, say 30 seconds?

(As Mirc will only output in .log, and I need the file in .txt)

Thank you in advance as always.

  DarkTorizo said:
OK, I have got it worked out...to a point.

&lt;html&gt;

&lt;head&gt;
&lt;META HTTP-EQUIV="Refresh"
CONTENT="30; URL=file:///c:/program files/mirc/AC1 Logged.htm"file:///c:\programs\mirc\index.htm">;title&gt;#AC1 Logged&lt;/title&gt;
&lt;base href="file:///c:\program files\mirc\index.htm" target="_self"&gt;
&lt;/head&gt;

&lt;body&gt;

&lt;p align="left"&gt;
&lt;IFRAME frameBorder=1 height=272 width=480 marginHeight=0 marginWidth=1 src="AC1.txt" name="AC1" scrolling="yes"&gt;
&lt;/IFRAME&gt;

&lt;/body&gt;

&lt;/html&gt;

I can display the .log/.txt file in an Iframe, now for the fun part.

The iframe will only display .txt files within itself, if I use a .log file it pops up in notepad outside of the web page.

is there any way to get the .log file in the iframe?

If not is there a program that can automatically convert .log to .txt at regular intervals, say 30 seconds?

(As Mirc will only output in .log, and I need the file in .txt)

Thank you in advance as always.

You could schedule a task that:

copy *.log *.txt

del *.log

or what not...

Why do you have to use an iframe? The object tag specifies that it's an embedded type (in this case a text file).

If you have to do that... make another html that contains the object tag stuff, then set that as the source for the iframe.

You shouldn't have to use an iframe. Scrap the meta refresh on the main page, and put it on the page contained in the iframe (not sure how this will be handled though). Test it.

  disturb3d said:
Or if thats too much for you, why dont you use a web based IRC client?

Is there one that isn't java? The PSP probably doesn't support java(?).

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.