Jump to content

images->deleteAll() cause images not saved


fliwire
 Share

Recommended Posts

why deleteAll() not working ? 

$u = user();
$u->of(false);

$files = explode("|", $form->get("images2")->value);

if($files) {
	$u->images->deleteAll(); // just want to one image, delete all images. - if delete this line images added.

  foreach($files as $file) {
    if($file && file_exists($upload_path . $file)){
      $u->images->add($upload_path . $file);
      unlink($upload_path . $file);
    }
  }
}

$u->save();

// $u->images->deleteAll() not working so i used this.
$u->images->delete($u->images->eq(0));
$u->save();
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...