Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2

Thread: Embed text file

  1. #1
    Junior Member
    Join Date
    Sep 2005
    Posts
    1
    Member #
    11325
    I need a web page to display a text file that is in the directory where the html page is. I've tried <embed BORDER="0" TYPE="text" src="test.txt" width="400" height="800"> but this dosen't work.

    The purpose is I could have a user ftp the file to the web server, and have the web page automatically display the text in the uploaded file.

  2.  

  3. #2
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    <embed> is for multimedia elements.

    You have a few options though.

    1: use a .js (javascript file) that writes all the text
    - example:
    Code:
    document.write("first line of text file");
    document.write("second line...");
    (you would save that as filename.js) To link (or embed it) you would do
    Code:
    <script src="filename.js"></script>
    2: use an iframe.

    3: Use a server side language (PHP/ASP) Here is an example in PHP
    PHP Code:
    <?php
    $filename 
    "test.txt";
    $fh fopen($filename'r');
    $Data fread($fhfilesize($filename));
    fclose($fh);
    echo 
    $Data;
    Hope this helps


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 02:16 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com