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
You can't put a Sub inside an If .. End If block. Also "space" is a function
name, so you can't use it as a variable name. And you appear to have too
many "end if" statements. And what happens if any of the folders the file is
in have spaces (eg. /my files/filename.jpg)? I'm assuming you won't have
this in your configuration, but it's worth considering as if this can occur
then you'll be potentially trying to put the file into a folder that doesn't
exist.
Sub reNameFile(oldFileName,newFileName)
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
fso.MoveFile server.mappath(oldFileName), server.mappath(newFileName)
Set fso = Nothing
End Sub
dim filenm, spacepos, nfilenm
filenm = request("filenm")
spacepos = instr(filenm," ")
if spacepos > 0 then
nfilenm = replace(filenm," ","")
call reNameFile(filenm, nfilenm)
end if
response.write nfilenm & "<br><br>"
--
Dan