473,594 Members | 2,823 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Trying to create hyperlinks

I am writing some code for an intranet and I need to be able to list the
files in folders and subfolders and display them in the browser window as
with hyperlinks.

I've picked up this very useful code on the internet from
www.4guysfromrolla.com. It works a treat, but one problem! If there is a
filename that contains a space, e.g., "my file.doc" the hyperlink only
links up to the space, e.g., it will hyperlink "my" and nothing else.

Here is the code which picks up file names without spaces and is called from
an HTML file as follows (maxitek being the name of my computer)
<a href="dir.asp?P P=C:\Inetpub\ww wroot\&UU=//maxitek">dir.as p</a>

Sub Main()
Dim sPP, sUP, fso, f, fc, ff, fl
sPP = Request.QuerySt ring("PP") 'Physical Path
sUP = Request.QuerySt ring("UP") 'URL Path

Set fso = CreateObject("S cripting.FileSy stemObject")
Set f = fso.GetFolder(s PP)
Set fc = f.Files
Set ff = f.SubFolders
For Each fl in fc
Response.Write "<a href=" & sUP & fl.name & ">" & fl.name & "</a> <br>"
Next
Set ff = nothing
Set fso = nothing
Set f = nothing
Set fc = nothing
End Sub

Main()
%>
Jul 22 '05 #1
3 1586
"laura" <re*****@group. com> wrote in message
news:#H******** ******@tk2msftn gp13.phx.gbl...
I am writing some code for an intranet and I need to be able to list the
files in folders and subfolders and display them in the browser window as
with hyperlinks.

I've picked up this very useful code on the internet from
www.4guysfromrolla.com. It works a treat, but one problem! If there is a
filename that contains a space, e.g., "my file.doc" the hyperlink only
links up to the space, e.g., it will hyperlink "my" and nothing else.

Here is the code which picks up file names without spaces and is called from an HTML file as follows (maxitek being the name of my computer)
<a href="dir.asp?P P=C:\Inetpub\ww wroot\&UU=//maxitek">dir.as p</a>

Sub Main()
Dim sPP, sUP, fso, f, fc, ff, fl
sPP = Request.QuerySt ring("PP") 'Physical Path
sUP = Request.QuerySt ring("UP") 'URL Path

Set fso = CreateObject("S cripting.FileSy stemObject")
Set f = fso.GetFolder(s PP)
Set fc = f.Files
Set ff = f.SubFolders
For Each fl in fc
Response.Write "<a href=" & sUP & fl.name & ">" & fl.name & "</a> <br>"
Next
Set ff = nothing
Set fso = nothing
Set f = nothing
Set fc = nothing
End Sub

Main()
%>


Make sure the href val is quoted. I like to use single quotes in this case:

Response.Write "<a href='" & sUP & fl.name & "'>" & fl.name & "</a> <br>"

--
Tom Kaminski IIS MVP
http://www.microsoft.com/windowsserv...y/centers/iis/
http://mvp.support.microsoft.com/
http://www.iistoolshed.com/ - tools, scripts, and utilities for running IIS
Jul 22 '05 #2
Tom,

YOU'RE WONDERFUL!!! Thank you so much!! It works.. stupid me for not
realising!

All the best
Laura
"Tom Kaminski [MVP]" <tomk (A@T) mvps (D.O.T) org> wrote in message
news:OK******** ******@TK2MSFTN GP09.phx.gbl...
"laura" <re*****@group. com> wrote in message
news:#H******** ******@tk2msftn gp13.phx.gbl...
I am writing some code for an intranet and I need to be able to list the
files in folders and subfolders and display them in the browser window as
with hyperlinks.

I've picked up this very useful code on the internet from
www.4guysfromrolla.com. It works a treat, but one problem! If there is a
filename that contains a space, e.g., "my file.doc" the hyperlink only
links up to the space, e.g., it will hyperlink "my" and nothing else.

Here is the code which picks up file names without spaces and is called

from
an HTML file as follows (maxitek being the name of my computer)
<a href="dir.asp?P P=C:\Inetpub\ww wroot\&UU=//maxitek">dir.as p</a>

Sub Main()
Dim sPP, sUP, fso, f, fc, ff, fl
sPP = Request.QuerySt ring("PP") 'Physical Path
sUP = Request.QuerySt ring("UP") 'URL Path

Set fso = CreateObject("S cripting.FileSy stemObject")
Set f = fso.GetFolder(s PP)
Set fc = f.Files
Set ff = f.SubFolders
For Each fl in fc
Response.Write "<a href=" & sUP & fl.name & ">" & fl.name & "</a>
<br>"
Next
Set ff = nothing
Set fso = nothing
Set f = nothing
Set fc = nothing
End Sub

Main()
%>


Make sure the href val is quoted. I like to use single quotes in this
case:

Response.Write "<a href='" & sUP & fl.name & "'>" & fl.name & "</a> <br>"

--
Tom Kaminski IIS MVP
http://www.microsoft.com/windowsserv...y/centers/iis/
http://mvp.support.microsoft.com/
http://www.iistoolshed.com/ - tools, scripts, and utilities for running
IIS

Jul 22 '05 #3
http://www.powerasp.com/content/new/...hyperlinks.asp

"laura" <re*****@group. com> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
I am writing some code for an intranet and I need to be able to list the
files in folders and subfolders and display them in the browser window as
with hyperlinks.

I've picked up this very useful code on the internet from
www.4guysfromrolla.com. It works a treat, but one problem! If there is a
filename that contains a space, e.g., "my file.doc" the hyperlink only
links up to the space, e.g., it will hyperlink "my" and nothing else.

Here is the code which picks up file names without spaces and is called
from an HTML file as follows (maxitek being the name of my computer)
<a href="dir.asp?P P=C:\Inetpub\ww wroot\&UU=//maxitek">dir.as p</a>

Sub Main()
Dim sPP, sUP, fso, f, fc, ff, fl
sPP = Request.QuerySt ring("PP") 'Physical Path
sUP = Request.QuerySt ring("UP") 'URL Path

Set fso = CreateObject("S cripting.FileSy stemObject")
Set f = fso.GetFolder(s PP)
Set fc = f.Files
Set ff = f.SubFolders
For Each fl in fc
Response.Write "<a href=" & sUP & fl.name & ">" & fl.name & "</a> <br>"
Next
Set ff = nothing
Set fso = nothing
Set f = nothing
Set fc = nothing
End Sub

Main()
%>

Jul 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
466
by: Tim | last post by:
Access 97: I have a table with a hyperlink field that I display on a form. I can click on the form field and the hyperlink activates correctly. However, if I try to activate the hyperlink using VB code, the last hyperlink that was clicked is the only one that displays. Background: The database is for providing instruction documentation for shop-floor personnel in a manufacturing environment. The main purpose of the database is to provide...
1
1447
by: Pat Moline | last post by:
Today, we have an informational dialog where the information is displayed in a RichText control. The only action for the user is to press the OK button to dismiss the dialog. My desire is to enhance this dialog by adding a “Go To” button where the user would select one of the informational items in the list, press the “Go To” button, the dialog would disappear, and then the “go to” action occurs. I still need to display...
1
1882
by: Axel Dahmen | last post by:
Hi, I can't create local fragment hyperlinks or JavaScript hyperlinks in ASP.NET. It always appends the current path to any value. How can I switch that off? Examples: * NavigateUrl="#highlight"
4
4233
by: Seefor | last post by:
Hi, I want my text hyperlinks to have a dotted border underneath, so I did this which works fine: a, a:link, a:visited, a:hover, a:active { color: #000; text-decoration: none;
9
2961
by: Viken Karaguesian | last post by:
Hello all, I'm making a calendar section in a website. Each month is its own page and navigated by Previous / Next links. I have it working now with standard hyperlinks, but I want to learn how to use Link Rel and Link Rev commands to do the navigation. At the W3C website it shows how to use the Link Rel and Link Rev in the <head> section:
1
1956
by: jez123456 | last post by:
Hi Experts I have a working c# application that users can store files (.doc, .xls, ..bmp, etc) as binary data into an Access database. I now need to extend this to also store hyperlinks. First of all I need some way of searching for the hyperlink. In Access there is an Insert Hyperlink dialog that can be used. Is there a similar dialog in c#? At the moment I use the OpenFileDialog to select files to be stored, could this be modified?
1
3636
by: Janna | last post by:
Hello tech savvy gurus! I hope someone can help me! THE PROBLEM: "Cannot open specified file" when I click on a hyperlink in an Access database when it is located on our server. THE BACKGROUND: I created a folder "Document Library" on my local drive, which contains document sub-folders and the database. For referential integrity, I designed the database with relative hyperlinks (e.g. Folder\File.pdf). The hyperlinks worked perfectly...
3
2864
by: prinsipe | last post by:
Hi all, what i'm doing is showing/hiding hyperlinks depending on the hyperlink clicked. it is partially working. when i call step1, all hyperlinks are hidden. but then i call step2, single and mulitple is visible. the problem is when i call step1 again, it does not hide single and multiple hyperlinks. any idea to solve my problem? thanks in advance! below is my sample script... function Step1() {...
12
5578
by: Frustratee | last post by:
Sorry guys, this is killing me. I have been fighting this issue for several weeks, to no avail. I am exporting the results of a query to an excel sheet, with one of the columns being from a field of hyperlinks that link to files on the shared drive. I CANNOT get the hyperlinks to be assigned. I can change the field name, but not the hyperlink address. Can't figure it out. 1) I have a header row 2) Column 16 is where the hyperlinks are...
0
7946
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
7877
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8253
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8374
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8009
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6661
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5411
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3903
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2389
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.