Kort fortalt prøver jeg på at få en side til at vise alle undermapper til Upload i et felt på en form. dette virker pt. med det lille fejl at den viser alle mapper i roden.
Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.GetFile(strPhysicalPath) Set objFolder = objFile.ParentFolder Set objFolderContents = objFolder.Files For each Folder in objFolder.SubFolders If Left(Folder.Name,1)<>"_" Then Response.write "<option " If ShowSub=Folder.Name Then Response.Write "selected " End if Response.Write"value='" & CurFile & "?ShowSub=" Response.Write(Replace(Folder.Name, " ", "%10")) response.write "'>" Response.Write(Folder.Name & "</option>") If ShowSub <= " " Then ShowSub = Folder.Name End if End if Next Set objFSO = Nothing %>
Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.GetFile(strPhysicalPath) Set objFolder = objFile.ParentFolder Set objFolderContents = objFolder.Files For each Folder in objFolder.SubFolders If Left(Folder.Name,1)<>"_" Then Response.write "<option " If ShowSub=Folder.Name Then Response.Write "selected " End if Response.Write"value='" & CurFile & "?ShowSub=" Response.Write(Replace(Folder.Name, " ", "%20")) response.write "'>" Response.Write(Folder.Name & "</option>") If ShowSub <= " " Then ShowSub = Folder.Name End if End if Next Set objFSO = Nothing %> </select></h3> </form> </td> </tr> </table>
<% If ShowPic > " " then ShowPic = Replace(ShowPic, " ", "%20") Response.Write "<a href='java script:history.go(-1)'><img src='" & ShowPic & "'><BR><BR><font face=""verdana"" size=""1""><b>Go Back</b></a>" Else %> <table border="0" cellpadding="0" cellspacing="5" style="border-collapse: collapse" bordercolor="#000000" width="100%" id="AutoNumber1"> <tr> <% strPhysicalPath = Server.MapPath(".\" & ShowSub) If ShowSub > " " then ShowSub = Replace(ShowSub, " ", "%20") Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFolder = objFSO.GetFolder(strPhysicalPath) Set objFolderContents = objFolder.Files
'Get the number of pictures in the subdirectory intTotPics = 0 For Each objFileItem in objFolderContents If Ucase(Right(objFileItem.Name,4))=".GIF" OR Ucase(Right(objFileItem.Name,4))=".JPG" THEN intTotPics = intTotPics + 1 End if Next
'Get the total number of pages in the subdirectory If (intTotPics/intPicsPerPage) = (int(intTotPics/intPicsPerPage)) Then intTotPages = int(intTotPics/intPicsPerPage) Else intTotPages = int(intTotPics/intPicsPerPage)+1 End If Redim strPicArray(2,intTotPics)
'Store picture file names in an array x = 0 For Each objFileItem in objFolderContents If Ucase(Right(objFileItem.Name,4))=".GIF" OR Ucase(Right(objFileItem.Name,4))=".JPG" THEN strPicArray(0,x) = objFileItem.Name strPicArray(1,x) = Cstr(int(x/intPicsPerPage)+1) x = x + 1 End if Next
'Determine if there are multiple pages and if so, display page numbers. If intTotPages > 1 Then Response.Write "<td colspan='" & intPicsPerRow & "' align='center'><font face='Verdana,Arial' size='1'>Page: " For x = 1 to intTotPages If x = intPage Then Response.Write "</font><font face='Arial' size='2'>" & x & "</font><font face='Arial' size='1'> " Else Response.Write "<a href='PhotoAlbum.asp?Page=" & x & "&ShowSub=" & ShowSub & "'>" & x & "</a> " End If Next Response.Write "</font></td>" Response.Write "</tr><tr><td> </td></tr><tr>" End If
hvad med denne del? <% strPhysicalPath = Server.MapPath(".\" & ShowSub) If ShowSub > " " then ShowSub = Replace(ShowSub, " ", "%20") Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFolder = objFSO.GetFolder(strPhysicalPath) Set objFolderContents = objFolder.Files
<% newpath = request.querystring("newpath") folderspec = upload/" if newpath<>"" then folderspec = folderspec & newpath & "/" end if
Set fs = CreateObject("Scripting.FileSystemObject")
Set folder = fs.GetFolder(server.mappath(folderspec)) Set subfolder = folder.subfolders
response.write "<h2>FOLDERS"
If newpath<>"" then Pointer = instrrev(newpath,"/") If Pointer>0 then UpOneLevel = Left(newpath,Pointer-1) response.write "<a href='" & request.servervariables("script_name") response.write "?newpath=" & UpOneLevel & "'>Up One Level</a><br>" Else response.write "<a href='" & request.servervariables("script_name") response.write "'>Up One Level</a><br>" End If End If
For Each newfolder in subfolder response.write "<A HREF='" response.write request.servervariables("script_name")
If newpath="" then response.write "?newpath=" & newpath & newfolder.name Else response.write "?newpath=" & newpath & "/" & newfolder.name End If response.write "'>" response.write newfolder.name & " - " & newfolder.datecreated response.write "</A>" Next
response.write "</blockquote><hr>" response.write "<h2>FILES</h2><blockquote>" Set filelist = folder.files
For Each file in filelist response.write "<A HREF='" response.write folderspec & file.name response.write "'>" response.write file.name & " - " & file.datecreated response.write "</A><br>" Next
set folder=nothing set subfolder=nothing set filelist=nothing set fs=nothing response.write "</blockquote><hr>" %>
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.