Space in filename

T

Ted Dawson

I have a page that writes a hyperlink to files in a folder, but the
hyperlink fails with the space in the filename. How can I strip out that
space or replace with   ?


<%Dim objFSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

Dim objFolder
Set objFolder = objFSO.GetFolder("C:\files\")
Response.Write "The files found in " & objFolder.Name & ":<br>"

Dim objFile
For Each objFile in objFolder.Files
Response.Write "<a href=http://www.yahoo.com/files/"
Response.Write objFile.Name
Response.Write " target=_blank"
Response.Write ">"
Response.Write objFile.Name
Response.Write "</a><br>"

Next

Set objFolder = Nothing
Set objFile = Nothing
Set objFSO = Nothing
%>
 
B

Bob Lehmann

HTML 101. Quote your attributes - at least the href. Or, stop putting spaces
in your file names.

Bob Lehmann
 
E

Evertjan.

Ted Dawson wrote on 06 nov 2004 in microsoft.public.inetserver.asp.general:
Response.Write "<a href=http://www.yahoo.com/files/"
Response.Write objFile.Name
Response.Write " target=_blank"
Response.Write ">"

Response.Write "<a href='http://www.yahoo.com/files/"
Response.Write objFile.Name
Response.Write "' target=_blank"
Response.Write ">"

It is always a good idea to look at your browser view-source.
You could/should have noticed the inconsistency of the html.
 
T

Ted Dawson

Thank you. Your reply was by far the most helpful, and not the least bit
snooty.

Ted
 
E

Evertjan.

Ted Dawson wrote on 06 nov 2004 in microsoft.public.inetserver.asp.general:
Thank you. Your reply was by far the most helpful, and not the least bit
snooty.

However there is a problem [trying my hand at being snooty].

This is not email, but usenet, so, if you do not quote a significant part
of the posting you are answering on, we don't have the faintest idea whom
you are addressing, unless we use timeconsuming special functions available
on some [and mine] newsreaders for browsing back to the previous post.

Please always quote[, preferably topquote or interquote, never toppost].
 
B

Bob Lehmann

Ted Dawson said:
Thank you. Your reply was by far the most helpful, and not the least bit
snooty.

Ted

[bottom posting to avoid snoot :>)]

Oh brother, Ted ....

Bob Lehmann
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top