Welcome Guest, Not a member yet? Register   Sign In
How to delete multiple images
#2

Code:
$media = new UploadModel();
        $file = $media->find($id);
        if (empty($file)) {
            return redirect('uploader');
        }
        $file_path = 'uploads/' . $file['upload_path'] . '/' . $file['file_name'];
        $small_path = 'uploads/' . $file['upload_path'] . '/small/' . $file['file_name'];
        $medium_path = 'uploads/' . $file['upload_path'] . '/medium/' . $file['file_name'];
        $extra_medium_path = 'uploads/' . $file['upload_path'] . '/extramedium/' . $file['file_name'];
        $all_files = array($file_path, $small_path, $medium_path, $extra_medium_path);
        if (!empty($file)) {
            @unlink($file_path);
            @unlink($small_path);
            @unlink($medium_path);
            @unlink($extra_medium_path);
            if ($media->delete($id)) {
                redirect()->to('uploader')->with('message', 'Media and styles are Deleted Successfully From Database');
            } else {
                redirect()->to('uploader')->with('message', 'Media Delete Errors');
            }
        }
        return redirect()->to('uploader');


I am Doing this way
Reply


Messages In This Thread
How to delete multiple images - by luckmoshy - 03-27-2022, 04:00 PM
RE: How to delete multiple images - by rmcdahal - 03-27-2022, 09:13 PM
RE: How to delete multiple images - by luckmoshy - 03-27-2022, 10:48 PM



Theme © iAndrew 2016 - Forum software by © MyBB