⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Delete uploaded files on delete record



xsigno
  • profile picture
  • Member

Posted 07 November 2011 - 10:23 AM

I would like to implement a function that delete uploaded files when deleting a record.

I used "$crud->callback_before_delete(array($this,'onDelete'));" in my index() function

and

function onDelete($theid)
{

}

How can i use $theid in order to delete the file? The field's name is 'foto'
Thank you.

xxaxxo
  • profile picture
  • Member

Posted 01 December 2011 - 11:26 AM

yes i have the same issue and the big problem is that you can't really debug your callback functions if you give up a little clearence about how the before_delete callback works and what param do you get with it is fired - it would be great.
Also when you have a "_n_n" (i have 3 db's - products, product_images, product_images_relational) - and i'm showing the products and the images in 1 render as 1db. I want when i delete the product -> to remove all the entries from all the db's and all the images from the server.

sodhancha
  • profile picture
  • Member

Posted 04 December 2011 - 07:03 AM

I have 2 tables
Users Table => id , username
OrdersTable => order_id,user_id, qty,total

I need to link these two tables with . id and user_id.
how can i do this ?

xxaxxo
  • profile picture
  • Member

Posted 04 December 2011 - 09:46 AM

Check the realtional functions ... and the examples - they are pretty handy.