Jump to content

Insert the content of a file in a html web page


Recommended Posts

Hi everyone, I want to know if I could do something as the next but with the content of a file: <img src=http://xxx.xxx.xxx.xxx/myPhoto> with this you can insert a picture from the ip address ... well my question is if is there something similar but the content of a file. I have a file 0000.txt which contains a name "homer simpson". I've tried with object : <object data="http://127.0.0.1/0000.txt"> It works but it introduce in the html code page the next: #document<html><head><style type="text/css"></style></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">homer simpson; </pre></body>Besides on the web page create a space.... it's like having two lines, and when you introduce it between they it seems 30 lines. So I want just the text, anything else ... but I can't get it ... thank you for your time and sorry for my english greetings!

Link to post
Share on other sites

Use an <iframe> element.<iframe src="file.txt"></iframe> The better alternative, though, is to use a server-side language to include the contents of the file.

Link to post
Share on other sites

Links like that won't work. You would have to do something like <img href="mysite.com/xxx-xxx-xxx-xxx.jpg"> so instead of 0000.txt it is xxx-xxx-xxx-xxx.txt. Inside of xxx-xxx-xxx-xxx.txt could be the link to the image and the name:xxx.xxx.xxx.xxx.txt:

img: http://mysite.com/xxx-xxx-xxx-xxx.jpgnam: Homer Simson

Or, you can use just one text file and just put the ips, names, and images inside there.data.txt:

ipx: 255.255.255.115img: http://mysite.com/255.255.255.115.jpgnam: Homer Simpsonipx: 255.255.255.120img: http://mysite.com/255.255.255.120.jpgnam: Lisa Simpsonipx: 255.255.255.125img: http://mysite.com/255.255.255.125.jpgnam: Bart Simpson[more... more... etc]

Then you can use functions to extract the data based on the IP address.

Edited by Err
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...