help - how can you make this so the files are hyperlinked???

Results 1 to 2 of 2

Thread: help - how can you make this so the files are hyperlinked???

  1. #1
    k everet Guest

    Default help - how can you make this so the files are hyperlinked???

    This lists files and lets you browse directories - but the files are not hyperlinked - how can you do this???<BR><BR><BR>&#060;%@ LANGUAGE="VBSCRIPT" &#037;&#062;<BR>&#060;!-------------------------------------------------------------------><BR>&#060;!--- Written by Toby Gramm. 070698 ---><BR>&#060;!--- Modified 092998 - Added support for Folders. ---><BR>&#060;!--- Modified 040699 - Made it pretty & added "Parent Directory" ---><BR>&#060;!--- functionality. ---><BR>&#060;!-------------------------------------------------------------------><BR>&#060;!------------------- http://www.techfools.com ----------------------><BR>&#060;!-------------------------------------------------------------------><BR>&#060;%<BR>sPP = Request.QueryString("PP") &#039Physical Path<BR>sUP = Request.QueryString("UP") &#039URL Path<BR>MODE = Request.QueryString("MODE") <BR>if sPP & "" = "" then sPP = GetPP<BR>if sUP & "" = "" then sUP = GetUP<BR>result = DIR(sPP,sUP) <BR><BR>Function DIR(byval sPP,byval sUP)<BR><BR> if right(sPP,1) &#060;> "\" then sPP = sPP & "\"<BR> if right(sUP,1) &#060;> "/" then sUP = sUP & "/"<BR> <BR> Response.Write "&#060;Font size=4>&#060;b>Index of " & sPP & "&#060;/b>&#060;/font><BR>&#060;hr>" <BR><BR> <BR> Set fso = CreateObject("Scripting.FileSystemObject")<BR> Set f = fso.GetFolder(sPP) <BR> Set fc = f.Files <BR> Set ff = f.SubFolders<BR><BR><BR> Response.Write "&#060;table cellpadding=2 cellspacing=2 border=0>"<BR> if MODE = "DRIVES" then<BR> Set dc = fso.Drives<BR> For Each d in dc <BR> Response.Write "&#060;tr>&#060;td width=15 valign=middle> &#060;/td>"<BR> Response.Write "&#060;td valign=middle>&#060;a href=dir.asp?PP=" & d.DriveLetter & ":>" & d.DriveLetter & ":&#060;/a> " & d.DriveType & "<BR>&#060;/td>&#060;/tr>"<BR> Next<BR> set dc = nothing<BR> else<BR> &#039 Set Parent folder<BR> if right(sPP,2) = ":\" then<BR> Response.Write "&#060;a href=" & chr(34) & "dir.asp?MODE=DRIVES" & chr(34) & ">&#060;b>DRIVE LIST&#060;/b>&#060;/a><BR><BR>"<BR> else<BR> Response.Write "&#060;tr>&#060;td width=15 valign=middle>&#060;img src=imagespardir.bmp>&#060;/td>"<BR> Response.Write "&#060;td valign=middle>&#060;a href=" & chr(34) & "dir.asp?PP=" & f.ParentFolder & "&UP=" & ParDir(sUP,"/") & chr(34) & ">&#060;b>PARENT DIRECTORY&#060;/b>&#060;/a><BR><BR>&#060;/td>&#060;/tr>"<BR> end if <BR><BR><BR> For Each f in ff<BR> Response.Write "&#060;tr>&#060;td width=15 valign=middle>&#060;img src=imagesfolder.bmp>&#060;/td>"<BR> Response.Write "&#060;td valign=middle>&#060;a href=" & chr(34) & "dir.asp?PP=" & sPP & f.name & "&UP=" & sUP & f.name & chr(34) & ">" & f.name & "&#060;/a>&#060;/td>&#060;/tr>"<BR> Next <BR> For Each f in fc<BR> Response.Write "&#060;tr>&#060;td width=15 valign=middle>&#060;img src=" & Image(f.name) & ">&#060;/td>"<BR> &#039Response.Write "&#060;td valign=middle>&#060;a href=" & chr(34) & "dir.asp?UP=" & sUP & f.name & chr(34) & ">" & f.name & "&#060;/a><BR>&#060;/td>&#060;/tr>" &#039only works in current domain.<BR> Response.Write "&#060;td valign=middle>" & f.name & "&#060;/td>&#060;/tr>" &#039only works in current domain.<BR> Next <BR> end if<BR> Set ff = nothing<BR> Set fso = nothing<BR> Set f = nothing<BR> Set fc = nothing <BR>End Function<BR><BR>Function ParDir(byval s,byval Slash)<BR>ParDir = ""<BR>if s & "" = "" then Exit Function<BR>s = left(s,len(s)-1)<BR> do while true<BR> c = right(s,1)<BR> if c = ":" then exit do<BR> if c &#060;> Slash then <BR> if len(s) &#060;= 0 then exit do<BR> s = left(s,len(s)-1)<BR> else<BR> exit do<BR> end if <BR> loop<BR> ParDir = s<BR>end function<BR><BR>Function Image(byval sName)<BR>Dim sType: sType = GetType(sName)<BR> Image = "images/"<BR> Select Case sType<BR> case ".htm"<BR> Image = Image & "html.bmp" <BR> case ".html"<BR> Image = Image & "html.bmp"<BR> case ".gif"<BR> Image = Image & "pic.bmp"<BR> case ".jpg"<BR> Image = Image & "pic.bmp"<BR> case ".jpeg"<BR> Image = Image & "pic.bmp"<BR> case ".bmp"<BR> Image = Image & "pic.bmp" <BR> case else<BR> Image = Image & "dontknow.bmp"<BR> end select <BR>End Function<BR><BR>Function GetPP &#039Physical Path<BR>dim s<BR>s = Request.ServerVariables("path_translated")<BR> Do while true<BR> if instr(s,"\") then<BR> if right(s,1) = "\" then exit do<BR> s = left(s,len(s)-1) <BR> else<BR> exit do<BR> end if<BR> loop<BR>GetPP = s<BR>End function<BR><BR>Function GetUP() &#039URL Path<BR>dim s<BR>s = Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("script_name")<BR> Do while true<BR> if instr(s,"/") then<BR> if right(s,1) = "/" then exit do<BR> s = left(s,len(s)-1) <BR> else<BR> exit do<BR> end if<BR> loop<BR>GetUP = "http://" & s<BR>End function<BR><BR>Function GetType(byval s) &#039Get file type<BR> Do while true<BR> if instr(s,".") then<BR> if left(s,1) = "." then exit do<BR> s = right(s,len(s)-1) <BR> else<BR> GetType = ""<BR> exit do<BR> end if<BR> loop<BR>GetType = s<BR>End function<BR>&#037;&#062;<BR>

  2. #2
    Stickman Guest

    Default RE: help - how can you make this so the files are hyperlinked???

    Just change this line:<BR>Response.Write "&#060;td valign=middle>" & f.name & "&#060;/td>&#060;/tr>" &#039only works in current domain.<BR>to this:<BR><BR>Response.Write "&#060;td valign=middle>&#060;a href=""" & f.name & """>" & f.name & "&#060;/a>&#060;/td>&#060;/tr>" &#039only works in current domain.<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •