Hi,
I'm trying to create a page that reads files from a folder and includes them in the page itself. Not just the name of the file, but the content as is.
I'm not very good at this coding-thing, (if at first you don't succeed...) smile
I had to split the "include file"-codebit to make it work as far as this.
Tthe sourse-code of the page looks just the way it should, but the included page won't render.
I hope you understand what I'm getting at.
What I want is this:
Name of file printed <br>
File content showing (the file is a bit of code that may be both images and text)<br>
My research has lead me to understand that this approach might not be the best one since the "include file" must be processed earlier to show up.
Any suggestions, anyone?
help much appreciated!
/K
My code looks like this so far...
<%
Dim fso, fld, fil
Dim incl1Text, incl2Text, inclEndText
incl1="<!--#incl"
incl2="ude file="
inclEnd="-->"
Dim inclComplete
inclComplete=incl1 & incl2
Dim incl
Dim strBody
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set fld = fso.GetFolder(Server.MapPath("../files"))
For Each fil in fld.Files
incl = inclComplete & """../files/" & fil.Name & """" & inclEnd
strBody = strBody & fil.Name & "<br>" & incl & "<br>"
Next
Response.Write(strBody)
%>
I'm trying to create a page that reads files from a folder and includes them in the page itself. Not just the name of the file, but the content as is.
I'm not very good at this coding-thing, (if at first you don't succeed...) smile
I had to split the "include file"-codebit to make it work as far as this.
Tthe sourse-code of the page looks just the way it should, but the included page won't render.
I hope you understand what I'm getting at.
What I want is this:
Name of file printed <br>
File content showing (the file is a bit of code that may be both images and text)<br>
My research has lead me to understand that this approach might not be the best one since the "include file" must be processed earlier to show up.
Any suggestions, anyone?
help much appreciated!
/K
My code looks like this so far...
<%
Dim fso, fld, fil
Dim incl1Text, incl2Text, inclEndText
incl1="<!--#incl"
incl2="ude file="
inclEnd="-->"
Dim inclComplete
inclComplete=incl1 & incl2
Dim incl
Dim strBody
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set fld = fso.GetFolder(Server.MapPath("../files"))
For Each fil in fld.Files
incl = inclComplete & """../files/" & fil.Name & """" & inclEnd
strBody = strBody & fil.Name & "<br>" & incl & "<br>"
Next
Response.Write(strBody)
%>