Hi,
I am trying that when on upload, any file that has a space in it's name gets the space removed thus the file ends up all one big word, right, liek example say the file name is "hello world.txt" I want it to be shurnk down to "helloworld.txt" I tried:
strFile = Replace(strNewFile, " ", "")
As you can se in the code below, I tried placing it in various places, either before the file is saved upl.save or after it and I've had no luck. When the upload is finished it gives me the file name and says it has been saved as I've wanted to save it, that is without filename spaces, but it gets uploaded with the spaces that the user origianlly uploaded the file with. I was hoping you guys can point me where to properly move my code or the proper code to use for this action that I want. Thank you, the code in question is below.
if Request.QueryString("uploader") = "true" then
Set upl = Server.CreateObject("SoftArtisans.FileUp") ' Creating upl object!
basePath = Server.MapPath(".") ' mapping the default path where files will be stored on the hard disk!
upl.Path = basePath & "\"
if not upl.IsEmpty Then 'we check if the object is empty or has a null value!
'on error resume next
strNewFile = upl.UserFilename 'Storing name of the file in a temporary variable!
strFile = Replace(strNewFile, " ", "_")
upl.Save 'Saving the uploaded file
strFile = lcase(Mid(strFile, InstrRev(strFile, "\") + 1))
strFormTrackFileExtension = lcase(Mid(strFile, InstrRev(strFile, ".")))
If strFormTrackFileExtension=".jpg" Then
Else
Response.Write "<html><head><title>WeeWeeSlap.com Scrapbook</title></head><body bgcolor=""#131313""><font color=""#FFFFFF""><li>Invalid file, it must be .jpg only.</li><br><a href=""javascript:history.go(-1)"">Go back and try a different file to upload</a></font></body></html>" & vbCrLf
Set ScriptObject = Server.CreateObject("Scripting.FileSystemObject")
strFile = "###########" & strFile
ScriptObject.DeleteFile(strFile)
Response.End
End If
strFileTemp = strFile
aryFileName = Split(strFile,"\")
lastVal = UBound(aryFileName) 'Checking the Ubound after spliting the file name!
strFile = aryFileName(lastVal)
strFileTemp = strFile 'actual file name with its type stored in a variable!
end If
end if
%>