From bd537c8ee633769234804b0d62a9e5e4dfaa0394 Mon Sep 17 00:00:00 2001 From: Kevin MacMartin Date: Sat, 18 Sep 2021 00:57:11 -0400 Subject: [PATCH] Fix the DashboardModel saveFile function for seeders --- app/Models/DashboardModel.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Models/DashboardModel.php b/app/Models/DashboardModel.php index 70cac68..4f20881 100644 --- a/app/Models/DashboardModel.php +++ b/app/Models/DashboardModel.php @@ -329,13 +329,16 @@ class DashboardModel extends Model $directory = public_path($this->getUploadsPath('file')); File::makeDirectory($directory, 0755, true, true); + // Set the base file path (including the file name but not the extension) + $base_filename = $directory . $this->id . '-' . $name . '.'; + // Save the file provided it's the correct extension if (gettype($file) == 'string') { if (!preg_match("/\.$ext/i", $file)) { return 'incorrect-format-fail'; } - copy($file, $base_filename . $main_ext); + copy($file, $base_filename . $ext); } else { if ($file->extension() != $ext) { return 'incorrect-format-fail';