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()
%> 3 1594
"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
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
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() %> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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...
|
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...
|
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"
|
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;
|
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:
| |
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?
|
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...
|
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()
{...
|
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...
|
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...
|
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...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |