Skip to main content
Inspiring
May 9, 2008
Question

Multiple Delete From Databse and Files also

  • May 9, 2008
  • 1 reply
  • 283 views
I am tring to remove the Images from the folders when their realted records are checked for deleteion, I want to make sure that if 2 records have been marked for deletion, The images realted to them should also get dleeted.

I tried something like this, but it did not seemed to wor, i know i am doing something wron here, but still unable to find actual way..

<cfif isdefined('form.delthisDestination')>
<cfinvoke
component="EcoLife.admin.CFC.destination"
method="ShowImage"
returnvariable="ShowImageRet"
onlyImg = "#trim(form.thisDestination)#"/>
<cfset holdrecord = ListToArray(form.thisDestination)>
<cfinvoke
component="EcoLife.admin.CFC.destination"
method="delRecords">
<cfinvokeargument name="completeList" value="#Trim(Form.thisDestination)#"/>
</cfinvoke>
<cfloop index="x" array="#holdRecord#">
<cfset holdImages = ListToArray(showImageRet.destinationImage)>
<cfoutput>
<cfif DirectoryExists("#request.file_path#\attachments\ebrochures\destinations\attachments")>
<cffile action="delete" file="#request.file_path#attachments\ebrochures\destinations\attachments\#holdImages#">
<cfelse>
</cfif>
</cfoutput>
</cfloop>
<cflocation addtoken="no" url="index.cfm?msg=3&action=#Hash(416)#">
</cfif>
This topic has been closed for replies.

1 reply