Bilgisayar Bölümü ASP Kod ve Script Arşivi


FSO ile tekil dosya isimleri

<%
Function GetFileName(FileName)
'This Function Is used when saving a file To check there Is Not already a file With the same name so that you don't overwrite it.
'It adds numbers To the filename e.g. file.gif becomes file1.gif becomes file2.gif And so On.
'It keeps going until it returns a filename that does Not exist.
'You could just create a filename from the ID field but that means writing the record - And it still might exist!
'N.B. Requires strSaveToPath variable To be available - And containing the path To save To
Dim Counter
Dim Flag
Dim strTempFileName
Dim FileExt
Dim NewFullPath
Set objFSO = CreateObject("Scripting.FileSystemObject")
Counter = 0
FileExt = GetExt(FileName)
strTempFileName = StripExt(FileName)
NewFullPath = strSaveToPath & "\" & FileName
Flag = False

Do Until Flag = True
If objFSO.FileExists(NewFullPath) = False Then
Flag = True
GetFileName = Mid(NewFullPath, InstrRev(NewFullPath, "\") + 1)
Else
Counter = Counter + 1
NewFullPath = strSaveToPath & "\" & strTempFileName & Counter & "." & FileExt
End If
Loop
End Function
%>

ASP Kitabı

 

Faydalılar: Altın Fiyatları |Hediye Kolye | pırlanta fiyatları
Ana Sayfa  Sık Kullanılanlara Ekle   admin[at]bilgisayarbolumu.com | © 2006 - 2020 Bilgisayarbolumu.com