We help IT Professionals succeed at work.
Get Started

Using multiple in select creates spaces??

Bob Schneider
on
386 Views
Last Modified: 2012-08-13
I am trying to attach files to an email by allowing a user to select file(s) from a select ojbect and it keeps adding a space between the file path and any files attached after the first.  Confusing?  Here is what I am using to get the file:

<select name="file_links" id="file_links" multiple>
	<%For i = 0 to UBound(FileArr) - 1%>
		<option value="<%=FileArr(i)%>"><%=FileArr(i)%></option>
	<%Next%>
</select>

Open in new window


Here is how I am breaking the string up:
	Dim sFiles
	Dim Files()
	
	sFiles = Request.Form.Item("file_links")

	j = 0
	ReDim Files(0)
	For i = 1 To Len(sFiles)
		If Mid(sFiles, i, 1) = "," Then
			Files(j) = CStr(Files(j))
			j = j + 1
			ReDim Preserve Files(j)
		Else
			Files(j) = Files(j) & Mid(sFiles, i, 1)
		End If
	Next

Open in new window


Here is my attachment code:
	If UBound(Files) > 0 Then
		For i = 0 To UBound(Files)
			.AddAttachment "c:\inetpub\h51web\etraxc\file_fldr\files\" & Files(i)
		Next
	End If

Open in new window


And here is the problem:
c:\inetpub\h51web\etraxc\file_fldr\files\CustomBlackBeltsOrderForm.xls
c:\inetpub\h51web\etraxc\file_fldr\files\ rprt_card_code.doc
c:\inetpub\h51web\etraxc\file_fldr\files\ Tortellini Soup.doc

(note the spaces between the file path and the file name in all but the first file..
Comment
Watch Question
Web Ninja at large
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 7 Answers and 13 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE