fliwire Posted May 17, 2019 Share Posted May 17, 2019 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 More sharing options...
fliwire Posted May 17, 2019 Author Share Posted May 17, 2019 solved. forgot to add destinationPath to images2 field. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now