From f5efb9639298a7394453862569dd056f93e82574 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Wed, 19 Jun 2019 17:36:33 +0100 Subject: [PATCH] Fixes directory to file issue, within config.php you must state your directory if its not in the main dir. --- application/controllers/Clublog.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/application/controllers/Clublog.php b/application/controllers/Clublog.php index 84d689fa..bac6b61b 100644 --- a/application/controllers/Clublog.php +++ b/application/controllers/Clublog.php @@ -8,11 +8,12 @@ class Clublog extends CI_Controller { // Show frontend if there is one public function index() { - + $this->config->load('config'); } // Upload ADIF to Clublog public function upload($username) { + $this->config->load('config'); ini_set('memory_limit', '-1'); ini_set('display_errors', 1); ini_set('display_startup_errors', 1); @@ -48,10 +49,18 @@ class Clublog extends CI_Controller { // initialise the curl request $request = curl_init('https://clublog.org/putlogs.php'); + 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']; + } + + echo $filepath; exit; + if (function_exists('curl_file_create')) { // php 5.5+ - $cFile = curl_file_create($_SERVER['DOCUMENT_ROOT']."/".$file_info['server_path']); + $cFile = curl_file_create($filepath); } else { // - $cFile = '@' . realpath($_SERVER['DOCUMENT_ROOT']."/".$file_info['server_path']); + $cFile = '@' . realpath($filepath); } // send a file