N
.Net Sports
If a filename of a file I upload has a space in it, i want to take the
space out and rename the file on the fly without the space in the
name. I'm using the instr function to see if there is a space in the
name. I can explicitly assign oldFileName and newFileName a value and
it works, but trying to fill the variables with a dynamic filename
doesnt do anything to the file in the code below, the filename still
has a space in it:
'''''''''''''''''''
filenm = request("filenm")
dim oldFileName,newFileName,space
space = instr(filenm," ")
if space > 0 then
oldFileName = filenm
newFileName = replace(filenm," ","")
Sub reNameFile()
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
fso.MoveFile server.mappath(oldFileName), server.mappath
(newFileName)
Set fso = Nothing
filenm = newFileName
End Sub
call reNameFile
end if
response.write filenm & "<br><br>"
end if
??????
NS
space out and rename the file on the fly without the space in the
name. I'm using the instr function to see if there is a space in the
name. I can explicitly assign oldFileName and newFileName a value and
it works, but trying to fill the variables with a dynamic filename
doesnt do anything to the file in the code below, the filename still
has a space in it:
'''''''''''''''''''
filenm = request("filenm")
dim oldFileName,newFileName,space
space = instr(filenm," ")
if space > 0 then
oldFileName = filenm
newFileName = replace(filenm," ","")
Sub reNameFile()
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
fso.MoveFile server.mappath(oldFileName), server.mappath
(newFileName)
Set fso = Nothing
filenm = newFileName
End Sub
call reNameFile
end if
response.write filenm & "<br><br>"
end if
??????
NS