PDA

View Full Version : i have problem with the space in the name of the file


bmwmpower
05-04-2003, 01:29 PM
in this code i have problem with the space in the name of the file

this is the code

Dim fso, f, f1, fc, c
If Request("Remove") <> "" Then
C=server.Mappath("Attachment")
Set fso = CreateObject("Scripting.FileSystemObject")
For Each f1 in Request("ID")
cf= c & "\" & f1
response.Write f1
'response.end
'fso.DeleteFile cf
Next
set fso= nothing
End If

'==========================
<FORM METHOD=GET ACTION="Attachments.asp">
<%

C=server.mappath("Attachment")
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(C)
Set fc = f.Files
For Each f1 in fc
'response.Write(f1.name)
Response.Write "<INPUT TYPE=CHECKBOX NAME=ID VALUE="& f1.name &">"&f1.name&"<BR>"
next
%>
<P>
<INPUT TYPE=SUBMIT NAME="Remove" VALUE="Remove">
</FORM>

in this code i have prblem when i make remove to file if in the name of file space it will not remove so i need help

oracleguy
05-05-2003, 01:13 AM
Originally posted by bmwmpower
in this code i have problem with the space in the name of the file

this is the code

Dim fso, f, f1, fc, c
If Request("Remove") <> "" Then
C=server.Mappath("Attachment")
Set fso = CreateObject("Scripting.FileSystemObject")
For Each f1 in Request("ID")
cf= c & "\" & f1
response.Write f1
'response.end
'fso.DeleteFile cf
Next
set fso= nothing
End If

'==========================
<FORM METHOD=GET ACTION="Attachments.asp">
<%

C=server.mappath("Attachment")
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(C)
Set fc = f.Files
For Each f1 in fc
'response.Write(f1.name)
Response.Write "<INPUT TYPE=CHECKBOX NAME=ID VALUE=""" & f1.name & """>"&f1.name&"<BR>"
next
%>
<P>
<INPUT TYPE=SUBMIT NAME="Remove" VALUE="Remove">
</FORM>



Try that, so there is quotes around the value when you output it, thats where your problem is. Without quotes it only uses whatever there is up until a space.

bmwmpower
05-05-2003, 12:00 PM
THANKS FOR YOUR HELP