ho fatto cosi... pero non succede nulla nel senso che non inserisce la foto sia che sia presente sul db che non ci sia
codice:
<%
id = request("id")
'connessione al database
Set Conn = Server.createobject("ADODB.Connection")
Conn.connectionstring="DRIVER={Microsoft Access Driver (*.mdb)};DBQ="& Server.Mappath("/mdb-database/ov.mdb")
Conn.Open
set fso = server.createObject("scripting.fileSystemObject")
set folder = fso.getFolder(server.mapPath("gallery") & "/" & id & "/")
set files = folder.files
'controllo file in cartella
for each file in files
rfn = right(file.name,4)
if rfn = ".jpg" or rfn = ".JPG" or rfn = ".png" or rfn = ".bmp" then
'effetto il controllo se la foto risulta gia presente
SQLL="Select * from foto where diritto='"&file.name& "'"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open SQLL, conn ,3,3
if rs.eof then
'NON è presente, memorizzo
'####################################################################################
SQL = "INSERT INTO foto (diritto,id_cat) VALUES ('"& file.name&"',"& id &")"
Conn.Execute SQL
end if
next
else
Response.Redirect "fotogallery.asp?txt=immagini+già+presenti!!!"
end if
set files = nothing
set folder = nothing
set fso = nothing
Conn.close
set Conn = nothing
response.Redirect "fotogallery.asp"
%>