Skip to content

Commit c58fac5

Browse files
committed
Preliminary support to handle non-image files
1 parent 4ba41fc commit c58fac5

File tree

6 files changed

+190
-63
lines changed

6 files changed

+190
-63
lines changed

public/js/jquery.form.min.js

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/controllers/FolderController.php

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,25 @@
66
use Illuminate\Support\Facades\Input;
77
use Illuminate\Support\Facades\Redirect;
88
use Illuminate\Support\Str;
9+
use Illuminate\Support\Facades\Session;
910

1011
/**
1112
* Class FolderController
1213
* @package Tsawler\Laravelfilemanager\controllers
1314
*/
1415
class FolderController extends Controller {
1516

17+
protected $file_location;
18+
19+
function __construct()
20+
{
21+
if (Session::get('lfm_type') == "Images")
22+
$this->file_location = Config::get('lfm.images_dir');
23+
else
24+
$this->file_location = Config::get('lfm.files_dir');
25+
}
26+
27+
1628
/**
1729
* Add a new folder
1830
*
@@ -21,14 +33,18 @@ class FolderController extends Controller {
2133
public function getAddfolder()
2234
{
2335
$folder_name = Str::slug(Input::get('name'));
24-
$path = base_path(Config::get('lfm.images_dir'));
36+
37+
$path = base_path($this->file_location);
2538

2639
if (!File::exists($path . $folder_name))
2740
{
2841
File::makeDirectory($path . $folder_name, $mode = 0777, true, true);
42+
return "OK";
43+
} else
44+
{
45+
return "A folder with this name already exists!";
2946
}
3047

31-
return Redirect::to('/laravel-filemanager?' . Config::get('lfm.params'));
3248
}
3349

3450

@@ -40,7 +56,7 @@ public function getAddfolder()
4056
public function getDeletefolder()
4157
{
4258
$folder_name = Input::get('name');
43-
$path = base_path(Config::get('lfm.images_dir'));
59+
$path = base_path($this->file_location);
4460
File::deleteDirectory($path . $folder_name, $preserve = false);
4561

4662
return Redirect::to('/laravel-filemanager?' . Config::get('lfm.params'));

0 commit comments

Comments
 (0)