Link to home
Start Free TrialLog in
Avatar of stingerman_1
stingerman_1

asked on

browse for file in web directory

I'm currently using classic asp to write an app.  I would like to find a way to be able to browse a specified directory on the webserver and take the selected file and write it as text to a text field.  Does anyone know of a way to do this?

thanks in advance,
stingerman_1
Avatar of GENTP
GENTP

You'll want to use the FileSystemObject object. I havn't done it in quite some time, but here's the resource I used for it, should be fairly intuitive (depending on expercience).

http://www.w3schools.com/asp/asp_ref_filesystem.asp
Avatar of blandyuk
You can use this for a file browser on your local site:

http://nscripts.havocaos.com/wumpus/download.asp

I use it on my dump sub-domain :) Once configured it's really good. Very nice interface.
Avatar of stingerman_1

ASKER

I am trying the wumpus route, but when I access the page I get the following error:



Microsoft VBScript runtime error '800a0009'

Subscript out of range: 'split(...)'

/wumpus/index.asp, line 29


Any clues? I did a response.write and it appeared as though my path was correct.
Can you post your code? I'm not familiar with how they've done it on that site.
<% @CodePage = 1257 Language = "VBScript" %>
<% Response.Buffer = true %>
<!-- #include file="config.asp" -->
<!-- #include file="stringbuilder.asp" -->
<%
' start a-profilin'
if bDebugMode then
      if bSoftWing then
            dim objProfiler
            set objProfiler = Server.CreateObject("Softwing.Profiler")
            objProfiler.ProfileStart()
      else
            dim dDebugTimer
            dDebugTimer = timer
      end if
end if

' some needed variables
dim sCurrentDir, sHost, sListPath, iFolderCount, iTotalFolderSize, iFileCount, iTotalFileSize, debug, view, vbDir
iFolderCount = 0 : iTotalFolderSize = 0 : iFileCount = 0 : iTotalFileSize = 0

' are we running as an index doc or error doc?
select case sRunMode

case "error"
' get the domain and port, eg. http://www.foo.com:80
sHost = sDomain & ":" & request.servervariables("SERVER_PORT")
' get the requested URL

response.Write request.servervariables("QUERY_STRING") & "-this is the query_string that isn't displaying "

*****************  LINE THAT ERRORS OUT!!  ************************
sCurrentDir = split(request.servervariables("QUERY_STRING"), ";")(1)
**************************************************************

' remove the host part
sCurrentDir = replace(sCurrentDir, sHost, "")

case "index"
' get the base URL
sCurrentDir = request.servervariables("SCRIPT_NAME")
' remove the script name
sCurrentDir = left(sCurrentDir, instrrev(sCurrentDir, "/"))

case else
response.write "Error: sRunMode must be either ""error"" or ""index"". Please check your config.asp file."
response.end

end select

' filesystem stuff
dim fs, fld, f
set fs = server.createobject("Scripting.FileSystemObject")
set fld = fs.getfolder(server.mappath(sCurrentDir))

' alternating background color
dim sBG
sBG = "tc2"

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>index of <%=sCurrentDir%></title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<style type="text/css" media="all">
/* general stuff */
body {margin:0}
a, a:visited {text-decoration:none; color:#000000}
a:hover {text-decoration:none; color:#757575}
img {border:0}
/* detailed view */
table {width:100%; border:0; padding:0; margin:0; empty-cells:show}
th {text-align:left; font-weight:bold; background-color: buttonface; cursor:default;
      border-width:1px; border-style: solid; border-color: buttonhighlight buttonshadow buttonshadow buttonhighlight;
}
th img {vertical-align:middle}
th, td {font-family:verdana, serif; font-size:11px; margin:0; padding:3px}
tr.tc {background-color:#fff}
tr.tc2 {background-color:#eee}
/* tiled view */
table.tiled {float:left; width:33.3%}
table.tiled:hover {background-color:buttonface}
table.tiled td.icon {width:32px}
span.small {font-family:verdana, serif; font-size:9px; color:#757575}
/* thumbnail view */
table.thumb {float:left; width:120px; height:120px; margin:8px}
table.thumb td {white-space:nowrap; text-align:center}
table.thumb td.icon {border:2px solid buttonface; width:120px; height:120px}
table.thumb td.icon:hover {border:2px solid #9999dd}
table.thumb td.icon img {vertical-align:middle}
img.thumbnail {max-width:100px; max-height:100px;
      width:expression(this.width > 100 ? 100 : true);
      height:expression(this.height > 100 ? 100 : true);
}
/* tree view */
ul {list-style-type:none; font-family:verdana, serif; font-size:11px; padding-left:18px; _padding-left:0}
li {padding-bottom:2px}
li img {vertical-align:middle}
li.p {list-style-image:url('<%=sDomain & sInstDir%>/images/dir_collapse.gif')}
li.c {list-style-image:url('<%=sDomain & sInstDir%>/images/dir_expand.gif')}
li.i {display:inline}
/* footer */
table.footer { clear:both;
      border-width:1px; border-style: solid; border-color: buttonshadow buttonhighlight buttonhighlight buttonshadow;
}
table.footer th {font-weight:normal; text-align:center}
table.footer th a img {vertical-align:middle}
/* debug */
div.debug {text-align:center; font-family:verdana, serif; font-size:10px; color:#757575}
a.debug, a.debug:visited {text-decoration: none; color:#757575}
a.debug:hover {text-decoration:none; color:#000000}
</style>
<!--[if lt IE 7]>
<script type="text/javascript" src="<%=sDomain & sInstDir%>/pngfix.js"></script>
<![endif]-->
<script type="text/javascript" src="<%=sDomain & sInstDir%>/sort.asp"></script>
</head>
<body>
<!-- #include file="header.html" -->
<table cellspacing="0">
<tr><th><img src="<%=sDomain & sInstDir%>/icons/folder_open_16.png" alt="<%=sCurrentDir%>" /> <%=sCurrentDir%></th></tr>
</table>

<%
view = request.cookies("view")
if len(view) = 0 then view = sDefaultView
set vbDir = new StringBuilder
select case view

'------------
' tiled view-
'------------

case "tiles"

' the "up one level" icon
vbDir.append("<table class=""tiled""><tr>" & vbCRLF)
vbDir.append("<td class=""icon""><a href="".."" title=""Up one level"">" & vbCRLF)
vbDir.append("<img src=""" & GetFolderImg("up") & """ alt=""Up one level"" /></a></td>" & vbCRLF)
vbDir.append("<td><a href="".."" title=""Up one level"">Up one level</a></td>" & vbCRLF)
vbDir.append("</tr></table>" & vbCRLF)

' subfolders
for each f in fld.subfolders
      if CanViewFile(f) then
            vbDir.append("<table class=""tiled""><tr>" & vbCRLF)
            vbDir.append("<td class=""icon""><a href=""" & CleanURL(f.name) & """ title=""Folder"">" & vbCRLF)
            vbDir.append("<img src=""" & GetFolderImg("closed") & """ alt=""Folder"" /></a></td>" & vbCRLF)
            vbDir.append("<td><a href=""" & CleanURL(f.name) & """ title=""Folder"">" & f.name & "</a></td>" & vbCRLF)
            vbDir.append("</tr></table>" & vbCRLF)
            iFolderCount = iFolderCount + 1
            iTotalFolderSize = iTotalFolderSize + f.size
      end if
next

' files
for each f in fld.files
      if CanViewFile(f) then
            vbDir.append("<table class=""tiled""><tr>" & vbCRLF)
            vbDir.append("<td class=""icon""><a href=""" & CleanURL(f.name) & """ title=""" & f.type & """>" & vbCRLF)
            vbDir.append("<img src=""" & GetExtImg(f.name) & """ alt=""" & f.type & """ /></a></td>" & vbCRLF)
            vbDir.append("<td><a href=""" & CleanURL(f.name) & """ title=""" & f.type & """>" & f.Name & "</a><br />")
            vbDir.append("<span class=""small"">" & FormatFileSize(f.size) & "</span></td>" & vbCRLF)
            vbDir.append("</tr></table>" & vbCRLF)
            iFileCount = iFileCount + 1
            iTotalFileSize = iTotalFileSize + f.size
      end if
next

response.write vbDir.tostring()

'---------------
'-detailed view-
'---------------

case "details"

' table header
vbDir.append("<table cellspacing=""0"" id=""details-table"">" & vbCRLF)
vbDir.append("<colgroup><col width=""20px"" /><col width=""40%"" /><col width=""20%"" /><col width=""20%"" /><col /></colgroup>" & vbCRLF)
vbDir.append("<thead id=""header"">" & vbCRLF)
vbDir.append("<tr>" & vbCRLF)
vbDir.append("<th>&nbsp;</th>" & vbCRLF)
vbDir.append("<th onclick=""sortTables(1)"">Name </th>" & vbCRLF)
vbDir.append("<th onclick=""sortTables(2)"">Size </th>" & vbCRLF)
vbDir.append("<th onclick=""sortTables(3)"">Type </th>" & vbCRLF)
vbDir.append("<th onclick=""sortTables(4)"">Last modified </th>" & vbCRLF)
vbDir.append("</tr>" & vbCRLF)

' the "up one level" link
vbDir.append("<tr class=""tc"">" & vbCRLF)
vbDir.append("<td><a href="".."" title=""Up one level"">" & vbCRLF)
vbDir.append("<img src=""" & GetFolderImg("up") & """ alt=""Up one level"" /></a></td>" & vbCRLF)
vbDir.append("<td><a href="".."" title=""Up one level"">..</a></td>" & vbCRLF)
vbDir.append("<td>&nbsp;</td>" & vbCRLF)
vbDir.append("<td>Up one level</td>" & vbCRLF)
vbDir.append("<td>&nbsp;</td>" & vbCRLF)
vbDir.append("</tr></thead>" & vbCRLF)

' subfolders
vbDir.append("<tbody id=""subfolders"">" & vbCRLF)
for each f in fld.subfolders
      if CanViewFile(f) then
            vbDir.append("<tr class=""" & sBG & """>" & vbCRLF)
            vbDir.append("<td><a href=""" & CleanURL(f.name) & """ title=""Folder"">" & vbCRLF)
            vbDir.append("<img src=""" & GetFolderImg("closed") & """ alt=""" & f.type & """ /></a></td>" & vbCRLF)
            vbDir.append("<td><a href=""" & CleanURL(f.name) & """ title=""Folder"">" & f.name & "</a></td>" & vbCRLF)
            vbDir.append("<td>" & FormatFileSize(f.size) & "</td>" & vbCRLF)
            vbDir.append("<td>" & f.type & "</td>" & vbCRLF)
            vbDir.append("<td>" & f.DateLastModified & "</td>" & vbCRLF)
            vbDir.append("</tr>" & vbCRLF)
            SwapBG
            iFolderCount = iFolderCount + 1
            iTotalFolderSize = iTotalFolderSize + f.size
      end if
next
vbDir.append("</tbody>" & vbCRLF)

'files
vbDir.append("<tbody id=""files"">" & vbCRLF)
for each f in fld.files
      if CanViewFile(f) then
            vbDir.append("<tr class=""" & sBG & """>" & vbCRLF)
            vbDir.append("<td><a href=""" & CleanURL(f.name) & """ title=""" & f.type & """>" & vbCRLF)
            vbDir.append("<img src=""" & GetExtImg(f.name) & """ alt=""" & f.type & """ /></a></td>" & vbCRLF)
            vbDir.append("<td><a href=""" & CleanURL(f.Name) & """ title=""" & f.type & """>" & f.name & "</a></td>" & vbCRLF)
            vbDir.append("<td>" & FormatFileSize(f.size) & "</td>" & vbCRLF)
            vbDir.append("<td>" & f.type & "</td>" & vbCRLF)
            vbDir.append("<td>" & f.datelastmodified & "</td>" & vbCRLF)
            vbDir.append("</tr>" & vbCRLF)
            SwapBG
            iFileCount = iFileCount + 1
            iTotalFileSize = iTotalFileSize + f.size
      end if
next
vbDir.append("</tbody>" & vbCRLF)

vbDir.append("</table>" & vbCRLF)

response.write vbDir.tostring()

'-----------
'-tree view-
'-----------

case "tree"

sListPath = sDomain
' the root folder
vbDir.append("<ul><li class=""p""><a href=""" & CleanURL(sListPath) & """ title=""" & sListPath & """>" & vbCRLF)
vbDir.append("<img src=""" & GetFolderImg("up") & """ alt="""" /> " & sListPath & "</a></li>" & vbCRLF)
vbDir.append("<li class=""i"">" & vbCRLF)

' path to the current folder
dim path, i
path = split(sCurrentDir, "/")
for i = 1 to ubound(path) - 1
sListPath = sListPath & "/" & path(i)
vbDir.append("<ul><li class=""p""><a href=""" & CleanURL(sListPath) & """ title=""" & sListPath & """>" & vbCRLF)
vbDir.append("<img src=""" & GetFolderImg("open") & """ alt="""" /> " & path(i) & "</a></li><li class=""i"">" & vbCRLF)
next

' subfolders
vbDir.append("<ul>" & vbCRLF)
for each f in fld.subfolders
      if CanViewFile(f) then
            vbDir.append("<li class=""c""><a href=""" & CleanURL(f.name) & """ title=""" & f.name & """>" & vbCRLF)
            vbDir.append("<img src=""" & GetFolderImg("closed") & """ alt=""" & f.type & """ /> " & vbCRLF)
            vbDir.append(f.name & "</a></li>" & vbCRLF)
            iFolderCount = iFolderCount + 1
            iTotalFolderSize = iTotalFolderSize + f.size
      end if
next

' files
for each f in fld.files
      if CanViewFile(f) then
            vbDir.append("<li><a href=""" & CleanURL(f.name) & """ title=""" & f.name & """>" & vbCRLF)
            vbDir.append("<img src=""" & GetExtImg(f.name) & """ alt=""" & f.type & """ /> " & vbCRLF)
            vbDir.append(f.name & "</a></li>" & vbCRLF)
            iFileCount = iFileCount + 1
            iTotalFileSize = iTotalFileSize + f.size
      end if
next

' close all those lists correctly
vbDir.append("</ul>" & vbCRLF)
for i = 1 to ubound(path)
vbDir.append("</li></ul>" & vbCRLF)
next

response.write vbDir.tostring()

'----------------
'-thumbnail view-
'----------------

case "thumbs"

' the "up one level" icon
vbDir.append("<table class=""thumb""><tr>" & vbCRLF)
vbDir.append("<td class=""icon""><a href="".."" title=""Up one level"">" & vbCRLF)
vbDir.append("<img src=""" & GetFolderImg("up") & """ alt=""Up one level"" /></a></td></tr>" & vbCRLF)
vbDir.append("<tr><td><a href="".."" title=""Up one level"">Up one level</a></td>" & vbCRLF)
vbDir.append("</tr></table>" & vbCRLF)

' subfolders
for each f in fld.subfolders
      if CanViewFile(f) then
            vbDir.append("<table class=""thumb""><tr>" & vbCRLF)
            vbDir.append("<td class=""icon""><a href=""" & CleanURL(f.name) & """ title=""Folder"">" & vbCRLF)
            vbDir.append("<img src=""" & GetFolderImg("closed") & """ alt=""Folder"" /></a></td></tr>" & vbCRLF)
            vbDir.append("<tr><td><a href=""" & CleanURL(f.name) & """ title=""Folder"">")
            if len(f.name) > 12 then
                  vbDir.append(left(f.name, 12) & "...")
            else
                  vbDir.append(f.name)
            end if
            vbDir.append("</a></td>" & vbCRLF)
            vbDir.append("</tr></table>" & vbCRLF)
            iFolderCount = iFolderCount + 1
            iTotalFolderSize = iTotalFolderSize + f.size
      end if
next

' files
for each f in fld.files
      if CanViewFile(f) then
            vbDir.append("<table class=""thumb""><tr>" & vbCRLF)
            vbDir.append("<td class=""icon""><a href=""" & CleanURL(f.name) & """ title=""" & f.type & """>" & vbCRLF)
            if IsImageFile(f.name) then
                  if bUseDotNetThumbs then
                        vbDir.append("<img src=""" & sDomain & sInstDir & "/getimage.aspx?img=" & sCurrentDir &_
                              CleanURL(f.name) & "&amp;w=" & iThumbWidth & """ alt=""" & f.type & """ />")
                  else
                        vbDir.append("<img src=""" & CleanURL(f.name) & """ alt=""" & f.type & """ class=""thumbnail"" />")
                  end if
            else
                  vbDir.append("<img src=""" & GetExtImg(f.Name) & """ alt=""" & f.type & """ />")
            end if
            vbDir.append("</a></td></tr>" & vbCRLF)
            vbDir.append("<tr><td><a href=""" & CleanURL(f.name) & """ title=""" & f.type & """>")
            if len(f.name) > 12 then
                  vbDir.append(left(f.name, 12) & "...")
            else
                  vbDir.append(f.name)
            end if
            vbDir.append("</a></td>" & vbCRLF)
            vbDir.append("</tr></table>" & vbCRLF)
            iFileCount = iFileCount + 1
            iTotalFileSize = iTotalFileSize + f.size
      end if
next

response.write vbDir.tostring()

end select
%>
<table cellspacing="0" class="footer">
<tr>
<th>
      <img src="<%=sDomain & sInstDir%>/icons/folder_closed_16.png" alt="Total Folders" /> Total Folders:
      <strong><%=iFolderCount%></strong>&nbsp;&nbsp;&nbsp;&nbsp;
      <img src="<%=sDomain & sInstDir%>/icons/folder_closed_16.png" alt="Total Folders Size" /> Total Folders Size:
      <strong><%=FormatFileSize(iTotalFolderSize)%></strong>&nbsp;&nbsp;&nbsp;&nbsp;
      <img src="<%=sDomain & sInstDir%>/icons/file_blank_16.png" alt="Total Files" /> Total Files:
      <strong><%=iFileCount%></strong>&nbsp;&nbsp;&nbsp;&nbsp;
      <img src="<%=sDomain & sInstDir%>/icons/file_blank_16.png" alt="Total Files Size" /> Total Files Size:
      <strong><%=FormatFileSize(iTotalFileSize)%></strong>
</th>
</tr>
<tr>
<th>
      <a href="<%=sDomain & sInstDir%>/setcookie.asp?view=tree" title="Tree View">
            <img src="<%=sDomain & sInstDir%>/images/view_tree.png" alt="Tree View" />
      </a>
      <a href="<%=sDomain & sInstDir%>/setcookie.asp?view=details" title="Detailed View">
            <img src="<%=sDomain & sInstDir%>/images/view_details.png" alt="Detailed View" />
      </a>
      <a href="<%=sDomain & sInstDir%>/setcookie.asp?view=tiles" title="Tiled View">
            <img src="<%=sDomain & sInstDir%>/images/view_tiles.png" alt="Tiled View" />
      </a>
      <a href="<%=sDomain & sInstDir%>/setcookie.asp?view=thumbs" title="Thumbnail View">
            <img src="<%=sDomain & sInstDir%>/images/view_thumbs.png" alt="Thumbnail View" />
      </a>
</th>
</tr>
</table>
<div class="debug">
<br />
<%
if bDebugMode then
      if bSoftWing then
            debug = FormatNumber((objProfiler.ProfileStop() / 10000), 8, -1, 0, 0)
            set objProfiler = nothing
      else
            debug = FormatNumber((timer - dDebugTimer), 8, -1, 0, 0)
      end if
      response.write "Seconds to generate: [" & debug & "]<br />"
end if
%>
<strong><a class="debug" href="http://nscripts.havocaos.com" title="Wumpus" rel="external">Wumpus v1.1</a></strong> - &copy; 2005
<a class="debug" href="mailto:indrek.haav@gmail.com" title="indrek.haav@gmail.com">Indrek Haav</a><br />
<!-- #include file="footer.html" -->
</div>
</body>
</html>

<%
' clean up
set fld = nothing
set fs = nothing
set vbDir = nothing
set objProfiler = nothing
%>

<%

function GetFileExt(byref filename)
' Returns the file extension for a given filename
if instr(filename, ".") > 0 then
      GetFileExt = lcase(right( filename, len(filename) - instrrev(filename, ".") ))
else
      GetFileExt = ""
end if
end function

function GetExtImg(byref filename)
' Returns the file icon for a given file extension
dim sResult, sExt
sExt = GetFileExt(filename)
select case sExt
' text files
case "txt", "css", "log", "ini"
      sResult = "txt"
' scripts
case "asp", "php", "pl", "plx", "cgi", "aspx", "asa", "js", "xml"
      sResult = "asp"
case "java", "jsp"
      sResult = "java"
' html
case "htm", "html", "shtml"
      sResult = "html"
' office documents
case "doc", "rtf"
      sResult = "doc"
case "xls"
      sResult = "xls"
case "ppt"
      sResult = "ppt"
case "mdb"
      sResult = "mdb"
' binaries
case "exe", "msi"
      sResult = "exe"
case "dll"
      sResult = "dll"
' disk images
case "iso", "img", "bin"
      sResult = "iso"
' executables
case "bat", "class"
      sResult = "bat"
' archives
case "zip", "rar", "ace", "jar", "tar"
      sResult = "zip"
' images
case "gif"
      sResult = "gif"
case "tif", "jpg", "jpeg", "bmp"
      sResult = "jpg"
case "png", "psd"
      sResult = "png"
' pdf
case "pdf"
      sResult = "pdf"
' flash
case "swf", "fla"
      sResult = "flash"
' video
case "avi", "mpeg", "mpg"
      sResult = "avi"
case "mov"
      sResult = "mov"
' audio
case "mp3", "mp4", "wav", "ogg", "aac", "au", "aiff"
      sResult = "mp3"
' windows media
case "wmv", "wma", "asf", "wmf"
      sResult = "wmv"
' blank
case "blank", ""
      sResult = "blank"
' others
case else
      sResult = "foo"
end select
GetExtImg = sDomain & sInstDir & "/icons/file_" & sResult & GetIconSize() & ".png"
end function

function GetFolderImg(byref fld)
' Returns the folder icon
GetFolderImg = sDomain & sInstDir & "/icons/folder_" & fld & GetIconSize() & ".png"
end function

function GetIconSize()
' Returns the icon size - 16, 32 or 48 pixels - based on the currently active view mode
if view = "thumbs" then
      GetIconSize = "_48"
elseif view = "tiles" then
      GetIconSize = "_32"
else
      GetIconSize = "_16"
end if
end function

function FormatFileSize(byref filesize)
' Formats the file size
if filesize > 1073741824 then
      FormatFileSize = FormatNumber((filesize / 1073741824), 2, -1, 0, 0) & " GB"
elseif filesize > 1048576 then
      FormatFileSize = FormatNumber((filesize / 1048376), 2, -1, 0, 0) & " MB"
elseif filesize > 1024 then
      FormatFileSize = FormatNumber((filesize / 1024), 2, -1, 0, 0) & " KB"
else
      FormatFileSize = filesize & " bytes"
end if
end function

sub SwapBG()
' Toggles the row background for detailed view
if sBG = "tc" then
      sBG = "tc2"
else
      sBG = "tc"
end if
end sub

function CleanURL(byref sURL)
sURL = replace(sURL, " ", "%20")
sURL = replace(sURL, "&", "&amp;")
CleanURL = sURL
end function

function CanViewFile(byref f)
' Determines whether or not the current file or folder can be viewed
CanViewFile = true
' should we show hidden and system files?
if (f.attributes AND 2) and not bShowHidden then CanViewFile = false
if (f.attributes AND 4) and not bShowSystem then CanViewFile = false
' is the file extension blocked?
if instr(sIgnoreExt, GetFileExt(f.name)) > 0 and f.type <> "File Folder" then CanViewFile = false
' hide index documents?
if (f.name = "default.asp" or f.name = "index.asp") and bHideIndexDoc then CanViewFile = false
end function

function IsImageFile(byref filename)
' Decides whether or not the current file is an image
' Image files get their thumbnail rendered in thumbs view
select case GetFileExt(filename)
case "jpg", "jpeg", "gif", "bmp", "png"
      IsImageFile = true
case else
      IsImageFile = false
end select
end function

%>
sCurrentDir = split(request.servervariables("QUERY_STRING"), ";")(1)

First thing I do when I see that is question the (1) on the end. You're calling the split() function, then have that extra set of brakets stuck in there.

If that doesn't do it, you may be attempting to split on a character that isn't present. So do an:

if inStr(request.servervariables("QUERY_STRING"),";") then
        sCurrentDir = split(request.servervariables("QUERY_STRING"), ";")
end if
If I remove the (1) I get a Type mismatch; If I use the IF statement I get

Server.MapPath() error 'ASP 0171 : 80004005'

Missing Path

/wumpus/index.asp, line 51
What does the query string actually look like on that page? What is the URL of the page the error comes up on?
the url is http://thekesselteam.no-ip.com  The query string looks like what you see above.
Do you have actual access to the server your hosting this on? As the best was for Wumpus to work is to change the 403;14 Custom error message to point to /index.asp or whatever page your going to call it.

Doing it this way you must set the following in the config.asp

' run as error doc (403.14) or index doc?
sRunMode = "error"

If you cant get access to the server, you can set it to:

' run as error doc (403.14) or index doc?
sRunMode = "index"

Which will make it run differently.

Anyway, I've recently developed a File Browser script anyway, download it here:

http://www.blandyuk.co.uk/file-browser.zip

I'm sure you can customise it to your requirements :)
I am trying your script and finding it very easy to install.
Obviously you'll have to secure it up as it currently give total access to anything on any Drive as long as the IUSR, (Anonymous Web Access), account has access.
I have one question regarding this new script...  Instead of downloading, how can I use the link to add that file's name to a text box?

thanks,
stingerman_1
Please re-download the zip again, I've updated it with the functionality you require ;)

Simply adds the filename to the textbox at the top.
Thank you sooo much for your help!  I will give this a shot and post back..
Without being too much of a pain, how could I then take that page and then limit the directory to 1 particular folder on 1 drive?  I think this is an awesome script!  

thanks a million,
stingerman_1
In the script, find these variables:

sPath = Request.QueryString("d")
sFile = Request.QueryString("f")

If you set them to a specific path, the user wont be able to go anywhere apart from what you specify. e.g.

sPath = "C:\my stuff\"
sFile = ""

I'd set sFile = "" as its a security risk. Someone could manually specify ?f=C:\... etc and download anything ;)

Only problem is they will be locked in that directory and wont be able to navigate anywhere. Quick way to get round this is to check sPath:

sPath = Request.QueryString("d")
If InStr(1, sPath, "C:\my stuff\", 1) = 0 Then sPath = "C:\my stuff\"

Just defaults them back to the home directory.
I'm getting a javascript syntax error when I click on a file.
Strange! Works fine here. Have you modified it in any way to cause this error?
When I put in in place I did not modify the code other than adding a link in the action attribute of the form element.

By the way, I am really enjoying this script!  Do you have any others?

thanks,
Stingerman_1
ASKER CERTIFIED SOLUTION
Avatar of blandyuk
blandyuk
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I will.  Thanks again for your work!
No problem :)