Added extension handling for file path
This commit is contained in:
parent
8657a80459
commit
bc873a3ece
|
@ -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") {
|
||||
|
|
Loading…
Reference in New Issue