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);