Ignore:
Timestamp:
10/24/21 21:42:47 (3 years ago)
Author:
beratkjufliju <kufliju@…>
Branches:
develop, master
Children:
169fcc8
Parents:
1c17e70
Message:

bug fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • app/Http/Controllers/Dashboard/FoldersController.php

    r1c17e70 r159e7df  
    284284        $path = Storage::disk('uploads')->path($folder->department->location . DIRECTORY_SEPARATOR . $folder->name);
    285285
    286         $files = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path));
    287 
    288         $filesInDoc = $FileSystem->allFiles($path);
    289 
    290         if(empty(!$filesInDoc)) {
     286        try {
     287            $files = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path));
     288
     289            $filesInDoc = $FileSystem->allFiles($path);
     290
    291291            foreach ($files as $file) {
    292292                if (!$file->isDir()) {
     
    300300            $headers = array('Content-Type' => 'application/octet-stream',);
    301301            $zip_new_name = Carbon::now()->format('d.m.Y - H:i') . $folder->name . '.zip';
    302                 return response()->download($zip_file, $zip_new_name, $headers);
    303         }
    304         else {
     302            return response()->download($zip_file, $zip_new_name, $headers);
     303        }
     304        catch (\Exception $e) {
    305305            Alert::flash("This folder has no files", "warning");
    306306            return redirect()->back();
    307307        }
    308 
    309308    }
    310309
Note: See TracChangeset for help on using the changeset viewer.