Skip to content

Commit bcb90c9

Browse files
committed
Create an option to perform chmod
1 parent cd5600f commit bcb90c9

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

docs/config.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
| raster\_mimetypes | array | Array of mime types. Thumbnails will be created only for these mimetypes. |
5959
| create\_folder\_mode | int | Permission setting for folders created by this package. |
6060
| create\_file\_mode | int | Permission setting for files uploaded to this package. |
61+
| should\_change\_file\_mode | boolean | If true, it will attempt to chmod the file after upload |
6162
| valid\_file\_mimetypes | array | Array of mime types. Available since v1.3.0 . |
6263

6364

src/config/lfm.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@
110110

111111
// permissions to be set on file upload.
112112
'create_file_mode' => 0644,
113+
114+
// If true, it will attempt to chmod the file after upload
115+
'should_change_file_mode' => true,
113116

114117
// available since v1.3.0
115118
// only when '/laravel-filemanager?type=Files'

src/controllers/UploadController.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ private function proceedSingleUpload($file)
8181
// Create (move) the file
8282
File::move($file->getRealPath(), $new_file_path);
8383
}
84-
chmod($new_file_path, config('lfm.create_file_mode', 0644));
84+
if (config('lfm.should_change_file_mode', true)) {
85+
chmod($new_file_path, config('lfm.create_file_mode', 0644));
86+
}
8587
} catch (\Exception $e) {
8688
array_push($this->errors, parent::error('invalid'));
8789

0 commit comments

Comments
 (0)