ciao a tutti,spero che possiate aiutarmi.
avendo il codice postato sotto, cosa devo aggiungere affinché mi cancelli le immagini nel folder,così com'è cancella solo nel db.
<%
Response.expires = 0
Response.expiresabsolute = Now() - 1
Response.addHeader "pragma", "no-cache"
Response.addHeader "cache-control", "private"
Response.CacheControl = "no-cache"
%>
<%
Response.Buffer = True
' Single delete record
key = Request.querystring("key")
If key = "" Or IsNull(key) Then
key = Request.Form("key")
End If
If key = "" Or IsNull(key) Then Response.Redirect "Gallerylist.asp"
sqlKey = sqlKey & "[id]=" & "" & key & ""
' Get action
a = Request.Form("a")
If a = "" Or IsNull(a) Then
a = "I" ' Display with input box
End If
' Open Connection to the database
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open xDb_Conn_Str
Select Case a
Case "I": ' Display
strsql = "SELECT * FROM [foto] WHERE " & sqlKey
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open strsql, conn
If rs.Eof Then
Response.Clear
Response.Redirect "Gallerylist.asp"
Else
rs.MoveFirst
End If
Case "D": ' Delete
strsql = "SELECT * FROM [foto] WHERE " & sqlKey
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open strsql, conn, 1, 2
Do While Not rs.Eof
rs.Delete
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
conn.Close
Set conn = Nothing
Response.Clear
Response.Redirect "filedelete.asp"
End Select
%>
<font size="-1">Delete from TABLE: Gallery
Torna alla lista
</font></p>
<form action="Gallerydelete.asp" method="post">
<input type="hidden" name="a" value="D">
<table border="0" cellspacing="1" cellpadding="4" bgcolor="#CCCCCC">
<tr bgcolor="#6699FF">
<td><font color="#FFFFFF"><font size="-1">Foto ID</font></font></td>
<td><font color="#FFFFFF"><font size="-1">Titolo</font></font></td>
<td><font color="#FFFFFF"><font size="-1">imglink</font></font></td>
</tr>
<%
recCount = 0
Do While Not rs.Eof
recCount = recCount + 1
' Setta il colore per riga
bgcolor = "#FFFFFF"
%>
<%
' Mostra colore diverso per riga
If recCount Mod 2 <> 0 Then
bgcolor = "#F5F5F5"
End If
%>
<%
x_id = rs("id")
x_Photo2Dtitle = rs("titolo")
x_imglink = rs("imglink")
x_descrizione = rs("descrizione")
%>
<tr bgcolor="<%= bgcolor %>">
<input type="hidden" name="key" value="<%= key %>">
<td><font size="-1">
<% Response.Write x_id %>
</font></td>
<td><font size="-1">
<% Response.Write x_Photo2Dtitle %><%
dim strFileQ
strFileQ = x_imglink
response.cookies("Qfile")= strFileQ
%>
</font></td>
<td><font size="-1">
<% Response.Write x_imglink %>
</font></td>
</tr>
<%
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
conn.Close
Set conn = Nothing
%>
</table>
%>
<%
response.write(request.cookies("Qfile"))
%>
<input type="submit" name="Action" value="CONFIRM DELETE">
</form>
grazie tantissimo a tutti.

Rispondi quotando