Pure ASP Upload Add On Pack Support Product Page

Answered

How to delete multiple images in all child data sets

Asked 15 Mar 2013 10:14:15
1
has this question
15 Mar 2013 10:14:15 Hans Kiesouw posted:
I have a situation where I need to delete records and images using a single "delete" proccess and also want to delete the related images.

There are 3 tables involved, a top level for "Procedures", then a table with related entries to that "Procedure" and each related entry, has multiple images associated with it.

I do have the ASP ADD ON PACK, which is used when users want to delete individual entries with the image, but I would like to allow users to delete their "Procedure" and "Entries" and all the images.

I did see some older posts (8 years ago and longer) but much of the code has been lost with all sorts of BBM code interspersed with the suggestions, so it makes little (or no) sense.

Any assistance will be appreciated.

Hans

Replies

Replied 27 Mar 2013 09:09:44
27 Mar 2013 09:09:44 Miroslav Zografski replied:
Hello Hans,

Unfortunately the extension needs some serious custom coding to be able to delete multiple files from a single table. Using it to delete files in related tables, where removing of the records is done on the SQL server is on another level - a new application build from scratch. Not exactly impossible but very hard to achieve and most likely not using the SQL remove of the related records in other tables.

Regards.
Replied 27 Aug 2015 16:39:38
27 Aug 2015 16:39:38 Baub Eis replied:
Here is the asp code to delete a dynamic folder. Each boat has an ID that has a custom folder so when I delete the record it also deletes the folder. Using asp and dreamweaver delete record. dont' know if that will help or not?

<%
' *** Delete Record: construct a sql delete statement and execute it

If (CStr(Request("MM_delete") <> "" And CStr(Request("MM_recordId") <> "" Then

' create the sql delete statement
MM_editQuery = "delete from " & MM_editTable & " where " & MM_editColumn & " = " & MM_recordId

If (Not MM_abortEdit) Then
' execute the delete
Set MM_editCmd = Server.CreateObject("ADODB.Command"
MM_editCmd.ActiveConnection = MM_editConnection
' Delete folder with record
'If (CStr(Request("MM_delete") <> "" And CStr(Request("MM_recordId") <> "" Then
Set fso = CreateObject("Scripting.FileSystemObject"
folderpath = Server.MapPath("\images\boats" 'change to the name the uploads root folder.
folderpath = folderpath & "\" & (request.querystring("boat_id") 'change to the name of your hidden field.
If fso.FolderExists(folderpath) Then
Set folderObject = fso.GetFolder(( folderpath) & "\"
folderObject.Delete
end if
Set folderObject = Nothing
Set fso = Nothing
'End if
' end of delete folder with record
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close

If (MM_editRedirectUrl <> "" Then
Response.Redirect(MM_editRedirectUrl)
End If
End If

End If
%>

Reply to this topic