Jump to content

delete file from folder

folder delete crud

  • Please log in to reply
5 replies to this topic

#1 tolaroath2011



  • Members
  • Pip
  • 1 posts

Posted 13 March 2012 - 09:13 AM

I have used grocery crud for my codeigniter and i know only use to crud to delete file from database but i also want to delete file from folder that store it. e.g: when i uploaded image this image need to store in folder images. So, when i delete this name of the image from database i want to delete also the image from the folder also.
Please anyone help me.
Best regard

#2 fastturtle



  • Members
  • PipPip
  • 11 posts

Posted 02 July 2012 - 08:54 PM


Did you ever get this to work? I also need to figure out how to do this.


#3 fdias


    grocery CRUD Addict

  • Members
  • PipPipPip
  • 93 posts

Posted 02 July 2012 - 10:59 PM

I don't understand the problem. When I remove a file from Grocery Crud it DOES get deleted from the folder.
What version of GCRUD are you using?
Make sure you have the proper permissions on the folder to write/read.

#4 fastturtle



  • Members
  • PipPip
  • 11 posts

Posted 03 July 2012 - 10:20 PM

When I delete a row from the table using Grocery Crud I then would like to write some code to remove (unlink) a related file off the server. Can I use the callback_after_delete and put in some php to unlink the file?

#5 mikelamar



  • Members
  • PipPip
  • 14 posts

Posted 03 July 2012 - 10:33 PM

Why you don't try the callback_before_delete ? You can do something custom like this:


public function crud_delete_file($primary_key)
    $row = $this->db->where('id',$primary_key)->get('your_table_name')->row();

    return true;

#6 fastturtle



  • Members
  • PipPip
  • 11 posts

Posted 04 July 2012 - 12:22 AM

Perfect thanks

Also tagged with one or more of these keywords: folder, delete, crud

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users