Commit 663be51015086480ffc6428c75420a4aac36a11f

Authored by Megan Watson
1 parent 104279ed

Added fix for symlinked uploads directories.

Committed by: Megan Watson
ktwebservice/KTUploadManager.inc.php
... ... @@ -103,7 +103,26 @@ class KTUploadManager
103 103 $this->temp_dir
104 104 );
105 105  
106   - return ($tempdir == $main_temp_dir);
  106 + $check = ($tempdir == $main_temp_dir);
  107 +
  108 + if($check){
  109 + return $check;
  110 + }
  111 +
  112 + // in case of a symlinked directory, check if the file exists and is in the uploads directory
  113 + $file = basename($tempfilename);
  114 + $path = $this->temp_dir . DIRECTORY_SEPARATOR . $file;
  115 +
  116 + if(file_exists($path)){
  117 + return true;
  118 + }
  119 +
  120 + // log the error
  121 + global $default;
  122 + $default->log->error('Upload Manager: can\'t resolve temporary filename: '.$tempfilename .' in uploads directory: '.$this->temp_dir);
  123 +
  124 + return false;
  125 +
107 126 /*
108 127 $tempdir = substr($tempfilename,0,strlen($this->temp_dir));
109 128 $tempdir = str_replace('\\','/', $tempdir);
... ...