C
carrzkiss
Hello All;
I am using the script from:
http://www.motobit.com/help/scptutl/pure-asp-upload.htm
Downloaded the version from here:
http://www.motobit.com/dlldownload/ScptUtl.exe (This will work on Winxp Pro
IIS 5.1)
OK.
What I am needing assistance on, is the File Renaming Function.
It will rename a file like so.
Existing File Name: something else to do.jpg
New File Name: something else to do-1.jpg
OK, what I am needing is for it to rename the file to something like this:
Existing File Name: something else to do.jpg
New File Name: something-else-to-do.jpg
If both exist then: something-else-to-do-1.jpg exc.... -2,-3,-4 and on
and on for renaming if file exist.
This is the code that is being used for what I can gather.
====================
Function GetUniqueFileName(FileName, DestPath)
if isempty(gFS) then Set gFS = CreateObject("Scripting.FileSystemObject")
Dim DotPos: DotPos = InStrRev(FileName,".")
if DotPos = 0 then DotPos = len(FileName)+1
Dim Counter, FullPath, NewFileName
Counter = 1
NewFileName = FileName
if gFS.FileExists(DestPath & "\" & NewFileName) then
Do
Counter = Counter + 1
NewFileName = Left(FileName, DotPos-1) & "-" & Counter _
& Mid(FileName, DotPos)
Loop while gFS.FileExists(DestPath & "\" & NewFileName)
end if
GetUniqueFileName = NewFileName
End Function
====================
Can anyone help out with this one?
Or suggest another renaming routine that will work just as well.
And this is very important, it must work cross platform.. This is very
important.
As I am going to have to dump my old Uploading script as it will not work
past IE6.
IE7 and above are dead to www.dmxzone.com Upload script. (Old Version dead,
and the new version is having major problems)
This script that I am using now, works on everything that I have tested it
with.
Thanks to all.
This is very important.
I have been doing a lot of searching and cannot seem to find any information
on the renaming
Putting together the words like: something-like-this.jpg and so forth.
Thanks
Carrzkiss
I am using the script from:
http://www.motobit.com/help/scptutl/pure-asp-upload.htm
Downloaded the version from here:
http://www.motobit.com/dlldownload/ScptUtl.exe (This will work on Winxp Pro
IIS 5.1)
OK.
What I am needing assistance on, is the File Renaming Function.
It will rename a file like so.
Existing File Name: something else to do.jpg
New File Name: something else to do-1.jpg
OK, what I am needing is for it to rename the file to something like this:
Existing File Name: something else to do.jpg
New File Name: something-else-to-do.jpg
If both exist then: something-else-to-do-1.jpg exc.... -2,-3,-4 and on
and on for renaming if file exist.
This is the code that is being used for what I can gather.
====================
Function GetUniqueFileName(FileName, DestPath)
if isempty(gFS) then Set gFS = CreateObject("Scripting.FileSystemObject")
Dim DotPos: DotPos = InStrRev(FileName,".")
if DotPos = 0 then DotPos = len(FileName)+1
Dim Counter, FullPath, NewFileName
Counter = 1
NewFileName = FileName
if gFS.FileExists(DestPath & "\" & NewFileName) then
Do
Counter = Counter + 1
NewFileName = Left(FileName, DotPos-1) & "-" & Counter _
& Mid(FileName, DotPos)
Loop while gFS.FileExists(DestPath & "\" & NewFileName)
end if
GetUniqueFileName = NewFileName
End Function
====================
Can anyone help out with this one?
Or suggest another renaming routine that will work just as well.
And this is very important, it must work cross platform.. This is very
important.
As I am going to have to dump my old Uploading script as it will not work
past IE6.
IE7 and above are dead to www.dmxzone.com Upload script. (Old Version dead,
and the new version is having major problems)
This script that I am using now, works on everything that I have tested it
with.
Thanks to all.
This is very important.
I have been doing a lot of searching and cannot seem to find any information
on the renaming
Putting together the words like: something-like-this.jpg and so forth.
Thanks
Carrzkiss