473,466 Members | 1,286 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Space in filename

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
%>
Jul 21 '05 #1
5 3214
HTML 101. Quote your attributes - at least the href. Or, stop putting spaces
in your file names.

Bob Lehmann

"Ted Dawson" <sc********@hotmail.com> wrote in message
news:eT*************@TK2MSFTNGP12.phx.gbl...
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 &nbsp; ?
<%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
%>

Jul 21 '05 #2
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.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress,
but let us keep the discussions in the newsgroup)

Jul 21 '05 #3
Thank you. Your reply was by far the most helpful, and not the least bit
snooty.

Ted
Jul 21 '05 #4
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].

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress,
but let us keep the discussions in the newsgroup)

Jul 21 '05 #5

"Ted Dawson" <sc********@hotmail.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
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
Jul 21 '05 #6

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

Similar topics

13
by: Bryan Parkoff | last post by:
I have seen that C/C++ Compiler supports long filename up to 254 characters plus the extension. Can header files and source code files accept space between alphabet character and numeric...
4
by: Paul Hadfield | last post by:
Hi, Wonder if anyone can help me on this, In DotNet2.0 I've been quite happily using the WriteAttributeString method of XmlWriter object, but have run into a problem when trying to output a...
2
by: Jacob.Bruxer | last post by:
Hi everyone, I'm having trouble opening space delimited textfiles in Excel from Visual Basic.net. I'm able to control, open and modify Excel files from Visual Basic, so my Excel reference seems...
4
by: nickyeng | last post by:
i read a file, and the file contains this: +-------------------+ | | +-------------------+ when i read it into array, and then display it out to cout exactly the same as...
2
by: Eran.Yasso | last post by:
Hi, My app updates mdb file with no probelm. the problem starts if there's a space on a column name(header consists from two words). I tried all sorts of things. here is my code: private void...
3
by: skyy | last post by:
Hi.. i have a string that i would want split on a single blank space only. eg. $string = File: abc.txt using split with white space i can get the name of the file : abc.txt However i run...
1
by: deerchao | last post by:
I used these codes to provide a default "Save As" filename for browsers: Response.AppendHeader("Content-Disposition", "attachment; filename=" + fileName); Response.ContentType =...
7
by: lawrence k | last post by:
I've got a music studio for a client. Their whole studio is run with Macintosh computers. Macintosh computers allow file names to have open white spaces, such as "animal hospital.mp3". I have a...
1
by: HxRLxY | last post by:
I have a program that shows a thumbnail of an image. If the user clicks on the thumbnail a new JFrame is opened that shows the full size image. If the image is larger than the screen, it gets...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
tracyyun
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...
0
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 project—planning, coding, testing,...
0
isladogs
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.