Her får du fortløbende numre i stedet for randum numre - og jo : navnet BLIVER checket i databasen.
<%
Function Checkfile(filename)
strSQL = "Select * From files Where filename='" & filename & "'"
Set rsUsercheck = ConnMain.Execute(strSQL)
If rsUsercheck.EOF Then
Checkfile = filename
Else
Randomize
filenumber = Int(Rnd*10000)+1
newfilename = "" & filename & "_" & nytFilnummer(filename) & ""
Checkfile = newfilename
End If
End Function
function nytFilnummer(filename)
strSQL = "Select count(*) AS antal From iles Where filename='" & filename & "'"
Set rs = ConnMain.Execute(strSQL)
nytFilnummer = rs("antal")+1
end function
Response.Write Checkfile("Testfil")
%>