From 866380b2e36dca48d57ff5211d5939dd3b36678a Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Tue, 6 May 2025 19:05:46 +0200 Subject: [PATCH] [Club Log] Check if directory exists --- application/models/Clublog_model.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/application/models/Clublog_model.php b/application/models/Clublog_model.php index 7fd43147e..13f6af2bf 100644 --- a/application/models/Clublog_model.php +++ b/application/models/Clublog_model.php @@ -59,7 +59,14 @@ class Clublog_model extends CI_Model if ($this->config->item('directory') != "") { $filepath = $_SERVER['DOCUMENT_ROOT'] . "/" . $this->config->item('directory') . "/" . $file_info['server_path']; } else { - $filepath = $_SERVER['DOCUMENT_ROOT'] . "/" . $file_info['server_path']; + } + $filepath = $_SERVER['DOCUMENT_ROOT'] . "/" . $file_info['server_path']; + + // Check if the file actually exists + if (!file_exists($filepath)) { + $return .= " Clublog upload for " . $station_row->station_callsign . ' failed. Upload file could not be created.'; + log_message('info', $return); + return $return . "\n"; } if (function_exists('curl_file_create')) { // php 5.5+ @@ -80,8 +87,8 @@ class Clublog_model extends CI_Model 'callsign' => $station_row->station_callsign, 'api' => $this->clublog_identifier, 'file' => $cFile - ) - ); + ) + ); // output the response curl_setopt($request, CURLOPT_RETURNTRANSFER, true);