From 26b0e4ebf0b0f2bcba9393e646a53047f8c84af8 Mon Sep 17 00:00:00 2001 From: Mark Unwin Date: Mon, 20 Nov 2023 07:58:40 +1000 Subject: [PATCH] Use correct path for Windows to custom_images. --- app/Models/ComponentsModel.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/Models/ComponentsModel.php b/app/Models/ComponentsModel.php index 9b07b2785..e0f0bfdbf 100644 --- a/app/Models/ComponentsModel.php +++ b/app/Models/ComponentsModel.php @@ -291,6 +291,9 @@ public function create($data = null): ?int } # $target = $_SERVER['DOCUMENT_ROOT'] . '/open-audit/custom_images/' . $filename; $target = APPPATH . '../public/custom_images/' . $filename; + if (php_uname('s') === 'Windows NT') { + $target = 'c:\\xampp\\htdocs\\open-audit\\custom_images\\' . $filename; + } if (@move_uploaded_file($_FILES['attachment']['tmp_name'], $target)) { $sql = 'INSERT INTO `image` VALUES (NULL, ?, ?, ?, ?, ?, NOW())'; $this->db->query($sql, [$data->device_id, $data->name, $filename, $data->orientation, $instance->user->full_name]);