Försöker att lista bilder ur en mapp med sökväg img1 Det borde väll bara vara att ersätta:lista bilder ut mapp
ligger scriptet i den foldern går det galant men inte om jag flyttar ut det.
behöver liksom bara ändra sökvägen lite men det vill sig inte. hur?? Please
<%@ Language=VBScript%>
<% set FileSysObj=CreateObject("Scripting.FileSystemObject")
strFileAndPath = request.servervariables("SCRIPT_NAME")
strPathOnly = Mid(strFileAndPath,1 ,InStrRev(strFileAndPath, "/"))
strFullPath = server.mappath(strPathOnly)
set fldr=FileSysObj.GetFolder(strFullPath)
'response.write("<H2>Folders list</H2>")
set FolderList = fldr.SubFolders
For Each FolderIndex in FolderList
Response.Write("" & FolderIndex.name & "<BR>")
Next
'response.write("<H2>Files list</H2>")
set FileList = fldr.Files
For Each FileIndex in FileList
'This bit excludes this page (and other asp files) from the list of links
if Lcase(right(FileIndex.Name, 4)) <> ".asp" then
Response.write("<div style='float:left; width: 200px; height: 200px; background-color : #f7f7f9; border-style: solid; border-color:#FFFFFF; border-width:1px; padding: 5px' align='center'><img src='" & FileIndex.name & "' width='120'>")
'Response.write("<img src='" & FileIndex.name & "' width='120'><br>")
Response.Write("<br>" & FileIndex.name & "<br></div>")
end if
Next
%>Sv: lista bilder ut mapp
strFileAndPath = request.servervariables("SCRIPT_NAME")
strPathOnly = Mid(strFileAndPath,1 ,InStrRev(strFileAndPath, "/"))
strFullPath = server.mappath(strPathOnly)
Med den sökväg du vill ha. T.ex.:
strFullPath = server.mappath("images/")
Eller:
strFullPath = server.mappath("/images/")
Eller:
strFullPath = server.mappath("../images/")