borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (MS Access & ASP?)Next Topic (Download text from a webpage) New Topic New Poll Post Reply
AndreaVB Forum : Internet Applications : HTML-based Cataloguer?
Poster Message
victorypoint
Level: Guest


icon HTML-based Cataloguer?

Hi,

My apologies for posting on the wrong forum. Hopefully I got it right this time.

Is there any sample code that would help me develop an server-side VB6 app that generates a web page catalogue of files and folders located on the same server.  I need users to click and download files from the web page (similar to an FTP site).

PS. I understand that I will need to use ASP pages but I definitely need help here.  I have experience with VB web classes so I'm not totally in the dark.

Any help is greatly appreciated.
-Alan  

25-01-2003 at 05:13 AM
| Quote Reply
vbgen
Level: Moderator

Registered: 10-10-2002
Posts: 876
icon Re: HTML-based Cataloguer?

okay, i thought i had an answer ready for you, but when i read the post again, well...

i have to ask, do you want to have a serverside script that creates a webpage that acts like a "table of contents"?

sorry to ask, i just got a bit confused.     

____________________________
Been busy trying to take a second degree <--it's not working out...

25-01-2003 at 05:31 PM
View Profile Send Email to User Show All Posts | Quote Reply
victorypoint
Level: Guest

icon Re: HTML-based Cataloguer?

Yes, that's another way or describing it.  It's essentially a webpage (or several) that act as a table of contents for scanned reports.  The files (JPEG in this case) are stored on the server's hard drive in a heirarchy of folders.

I originally thought of creating a VB/webclass app that shells out to DOS, executes a "dir/s/b>dump.txt" and then converts the txt file into an HTML page.  However, this technique requires VB runtime components on the W2K/IIS server (which might not be allowed).  Is there a better way using ASP or other technologies?

-Alan

25-01-2003 at 08:02 PM
| Quote Reply
JLRodgers
Level: Moderator

Registered: 04-04-2002
Posts: 1617
icon Re: HTML-based Cataloguer?

This may help... Can't debug really, since XP Home doesn't have IIS... But it does do a directory.

A style sheet was used with the following relevant to the code:
#Indent10 { text-indent: 10px; }
#indent20 { text-indent: 20px; }
#Indent30 { text-indent: 30px; }
#Indent40 { text-indent: 40px; }
#indent50 { text-indent: 50px; }
#Indent60 { text-indent: 60px; }


<%
Dim sDir
Dim tmp
Dim OffSet

sDir=Request.ServerVariables("APPL_PHYSICAL_PATH")

tmp = sDir

If Right(tmp,1)="" Then OffSet=1 Else OffSet=0

If InStr(1,tmp,"")>0 Then
For i=len(tmp)-OffSet to 0 Step -1
If Mid(tmp,i,1) ="" Then
tmp=Mid(tmp,i+1,len(tmp))
i=0
End If
Next
End If

Disp "<ui><li id=""indent10""><b>" & tmp & "</b></li></ui>"

If Request.ServerVariables("Logon_User") <> "" Then
Walkthrough sDir, 20
Else
Disp "<ui><li id=""indent10"">Unable to display directory listing without being logged in.</li></ui>"
End IF
%>

<%
Sub Walkthrough(dirname, Indent)
On Error Resume next
Dim MyDirectory
Dim MyFiles

Set MyDirectory=Server.CreateObject("Scripting.FileSystemObject")
Set MyFiles=MyDirectory.GetFolder(dirname)

If Err.Description <> "" Then
err.clear
dirname = replace(dirname, "help", "inc/help")
Set MyFiles=MyDirectory.GetFolder(dirname)
End If

' Display Files
For each filefound in MyFiles.files
Disp "<ui><li id=""Indent" & Indent &""">" & filefound.Name & "</li></li></ui>"
Next

' Run routine for all directories
For each filefound in MyFiles.SubFolders
If filefound.Name <> dirname Then
Disp "<ui><li id=""Indent20""><b>" & Filefound.Name & "</b></li></ui>"
WalkThrough Request.ServerVariables("APPL_PHYSICAL_PATH") & filefound.Name, 30
End If
Next
End Sub
%>

____________________________
Everywhere's Local (classifieds, job postings, & more for everycity in the world - user entered)

25-01-2003 at 09:50 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
victorypoint
Level: Guest

icon Re: HTML-based Cataloguer?

Thanks for the ASP code.  I tried it out but got this error: Type mismatch: 'Disp'.  Is Disp a function?

-Alan

26-01-2003 at 01:28 AM
| Quote Reply
JLRodgers
Level: Moderator

Registered: 04-04-2002
Posts: 1617
icon Re: HTML-based Cataloguer?

Oops... the asp website I created was highly modular...


<%
' Function to Format HTML Codes, Takes value and adds <ENTER>
Function Disp(Code)
Response.Write Code & Chr(13)
End Function
%>

____________________________
Everywhere's Local (classifieds, job postings, & more for everycity in the world - user entered)

26-01-2003 at 01:46 AM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
vbgen
Level: Moderator

Registered: 10-10-2002
Posts: 876
icon Re: HTML-based Cataloguer?

of course, this code will work granting that you can use the fso object in your site...

<%
Dim fso, folder, file, path, dq
dq = Chr(34) ' double quote
Set fso = Server.CreateObject("Scripting.FileSystemObject")
path = Server.MapPath("foldername")
Set folder = fso.GetFolder(path)
For Each file In folder.Files
     Response.Write "<a href=" & dq & file.Path & dq & ">" & _
     file.Name & "</a><br>" & vbCrLf
Next
%>


i think that JL's code works with a better interface for the user, but i believe this code also gets the job done.

____________________________
Been busy trying to take a second degree <--it's not working out...

26-01-2003 at 12:24 PM
View Profile Send Email to User Show All Posts | Quote Reply
victorypoint
Level: Guest

icon Re: HTML-based Cataloguer?

Thanks very much JLRodgers.  I got it to work!

Vbgen, I tried your code as well for the c:inetpubwwwroot folder but got this error: The Path parameter for the MapPath method must be a virtual path. A physical path was used.  I then tried "http://localhost/" but got this error: An invalid character was specified in the Path parameter for the MapPath method.

Sorry for my inexperience with VBScript.  My background is VB.

-Alan

26-01-2003 at 08:35 PM
| Quote Reply
vbgen
Level: Moderator

Registered: 10-10-2002
Posts: 876
icon Re: HTML-based Cataloguer?

okidokie... i'll see what i can do about this.

ummm... are you using personal web server? or another offline software like that?

anyway, i'll try to get on to this problem.
later.

____________________________
Been busy trying to take a second degree <--it's not working out...

27-01-2003 at 03:18 AM
View Profile Send Email to User Show All Posts | Quote Reply
victorypoint
Level: Guest

icon Re: HTML-based Cataloguer?

I'm using W2K Pro & IIS 5.

-Alan

27-01-2003 at 04:36 AM
| Quote Reply
vbgen
Level: Moderator

Registered: 10-10-2002
Posts: 876
icon Re: HTML-based Cataloguer?

this is what i've been able to gather:

IIS has the Personal Web Manager found in Control Panel under Administrative Tools. Run that and under the Advanced button you can create the virtual folder and the directory it points to. not sure if that will work. you may also have to have write permission to write to the directory as well (write permissions can get quite annoying sometimes).

____________________________
Been busy trying to take a second degree <--it's not working out...

27-01-2003 at 05:19 PM
View Profile Send Email to User Show All Posts | Quote Reply
victorypoint
Level: Guest

icon Re: HTML-based Cataloguer?

Thanks again vbgen.  I was able to get it to work by reading about the MapPath function at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iisref/html/psdk/asp/vbob98iw.asp.

Thanks for all your help folks.  Much appreciated.
-Alan

[Edited by victorypoint on 28-01-2003 at 08:10 PM GMT]

28-01-2003 at 08:09 PM
| Quote Reply
AndreaVB Forum : Internet Applications : HTML-based Cataloguer?
Previous Topic (MS Access & ASP?)Next Topic (Download text from a webpage) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder