Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP 3.0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 28th, 2004, 04:17 AM
Registered User
 
Join Date: Dec 2004
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Ch. 10 Directory listing

Hello everyone. I took the code for directory listing in chapter 10

I have this code
<HTML>
<HEAD>
<TITLE>AM Signalen</TITLE>
</HEAD>
<BODY>


<%
Dim strPathInfo, strPhysicalPath
strPathInfo = Request.ServerVariables("PATH_INFO")
strPhysicalPath = Server.MapPath(strPathInfo)

Dim objFSO, objFile, objFileItem, objFolder, objFolderContents
Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objFile = objFSO.GetFile(strPhysicalPath)
Set objFolder = objFile.ParentFolder
Set objFolderContents = objFolder.Files
%>

<TABLE cellpadding=5>
<TR align=center>
<TH align=left>File Name</TH>
<TH>Type</TH>
<TH>File Size</TH>
<TH>Last Modified</TH>
</TR>

<%
For Each objFileItem in objFolderContents
%>

    <TR>
     <TD align=left>
     <A HREF="<%= objFileItem.Name %>">
     <%= objFileItem.Name %>
     </A>
     </TD>
     <TD align=right>
     <%= objFileItem.type %>
     </TD>
     <TD align=right>
     <%= objFileItem.size %>
     </TD>
     <TD align=right>
     <%= objFileItem.DateLastModified %>
     </TD>
    </TR>

<%
Next
%>

</TABLE>
</BODY>
</HTML>



But it shows the files in the directory this file resides. I included 3 files (upper config.asp & inc_header, down inc_footer.asp) to give this page my own look and feel. Therefore i need the code to place in my /forum directory. This code shown above gives me a directory listing of that directory. How can ik rewrite my code so the codefile is in the /forum directory but i can point to another directory to show files, for example http://www.mixz.local/amsignals

Thanx in advance
  #2 (permalink)  
Old March 3rd, 2005, 07:39 AM
Registered User
 
Join Date: Mar 2005
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

I'm a beginner, here, too.

However, I have a similar problem to yours, and have solved part of it.

In order to make the script list the contents of a different directory than the one it lives in, you need to change the value of the strPhysicalPath variable...

I just directly set mine to the directory concerned like this:

strPhysicalPath = Server.MapPath("../../test/dummy.asp")

and put a dummy ASP file into the relevant directory.

Running the script from it's own resting place (<root_directory>/scripts/wroxbook/) it correctly displays the content of the directory: <root_directory>/test/

What I can't figure out is how to make the displayed links fetch the right pages (from the <root_directory>/test/ directory), rather than returning a 404 error (because it seems to be trying to fetch them from the <root_directory>/scripts/wroxbook/ directory)...

Any suggestions welcome.

WBW

H.

 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Listing 8-10 and Listing 8-16. Asp.Net BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 1 February 6th, 2008 01:11 PM
Listing of Directory Content ram_dwivedi Javascript 3 December 9th, 2005 05:13 AM
FSO directory listing spinout Classic ASP Components 4 November 7th, 2004 03:18 AM
Directory Listing Bleetz Pro JSP 1 September 20th, 2003 06:25 PM



All times are GMT -4. The time now is 01:54 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.