Skip to content

Commit

Permalink
Use correct path for Windows to custom_images.
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-unwin committed Nov 19, 2023
1 parent f4e2246 commit 26b0e4e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/Models/ComponentsModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down

0 comments on commit 26b0e4e

Please sign in to comment.