Jump to content

Insert the content of a file in a html web page


pawqar

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 comment
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 comment
Share on other sites

Hi, first of all, I want to thank you for your time. I tried it but It doesn't work. It appears a horrible box, xD. At the end I will have to write a function to obtain the name. Cachis! Maybe I do wrong, thank you!!

Link to comment
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 comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...