diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index 6c8c5d992..e31e6fd4e 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -399,6 +399,17 @@ SQL; $this->_file->save(); } + + public function getRealFileExtension() { + $path = $this->_file->getDbFilepath(); + $path_elements = explode('.', $path); + if (count($path_elements) < 2) { + return ""; + } else { + return $path_elements[count($path_elements) - 1]; + } + } + /** * Return suitable extension. * @@ -407,9 +418,13 @@ SQL; */ public function getFileExtension() { - //return ""; // TODO : what's the point of having this function? Can we not just use // the extension from the file_path column from cc_files? + $possible_ext = $this->getRealFileExtension(); + if ($possible_ext !== "") { + return $possible_ext; + } + $mime = $this->_file->getDbMime(); if ($mime == "audio/ogg" || $mime == "application/ogg") {