diff --git a/src/controllers/UploadController.php b/src/controllers/UploadController.php index 66245aa..1837a44 100644 --- a/src/controllers/UploadController.php +++ b/src/controllers/UploadController.php @@ -58,38 +58,42 @@ public function upload() if (Session::get('lfm_type') == "Images") { - $file = Input::file('file_to_upload'); - $working_dir = Input::get('working_dir'); - $destinationPath = base_path() . "/" . $this->file_location; - - $extension = $file->getClientOriginalExtension(); - - if(!empty($this->allowed_types["Images"]) && !in_array($extension, $this->allowed_types["Images"])) - { - return "File type is not allowed!"; - exit; - } - - if (strlen($working_dir) > 1) - { - $destinationPath .= $working_dir . "/"; - } - - $filename = $file->getClientOriginalName(); - - $new_filename = Str::slug(str_replace($extension, '', $filename)) . "." . $extension; - - Input::file('file_to_upload')->move($destinationPath, $new_filename); - - if (!File::exists($destinationPath . "thumbs")) - { - File::makeDirectory($destinationPath . "thumbs"); - } - - $thumb_img = Image::make($destinationPath . $new_filename); - $thumb_img->fit(200, 200) - ->save($destinationPath . "thumbs/" . $new_filename); - unset($thumb_img); + $files = Input::file('file_to_upload'); + foreach ($files as $file) { + + $working_dir = Input::get('working_dir'); + $destinationPath = base_path() . "/" . $this->file_location; + + $extension = $file->getClientOriginalExtension(); + + if(!empty($this->allowed_types["Images"]) && !in_array($extension, $this->allowed_types["Images"])) + { + return "File type is not allowed!"; + exit; + } + + if (strlen($working_dir) > 1) + { + $destinationPath .= $working_dir . "/"; + } + + $filename = $file->getClientOriginalName(); + + $new_filename = Str::slug(str_replace($extension, '', $filename)) . "." . $extension; + + $file->move($destinationPath, $new_filename); + + if (!File::exists($destinationPath . "thumbs")) + { + File::makeDirectory($destinationPath . "thumbs"); + } + + $thumb_img = Image::make($destinationPath . $new_filename); + $thumb_img->fit(200, 200) + ->save($destinationPath . "thumbs/" . $new_filename); + unset($thumb_img); + + } return "OK"; } else diff --git a/src/views/index.blade.php b/src/views/index.blade.php index 7e8ca5c..70677ba 100644 --- a/src/views/index.blade.php +++ b/src/views/index.blade.php @@ -91,12 +91,12 @@ class="fa fa-list"> {!! Lang::get('laravel-filemanager::lfm.nav-list') !!}