- added methods in dmslib for adding and removing files and file versions

- FS_Model: added remove method
This commit is contained in:
KarpAlex
2021-12-13 10:04:15 +01:00
parent 9b1182405e
commit d6fb714b21
2 changed files with 440 additions and 0 deletions
+19
View File
@@ -114,6 +114,25 @@ class FS_Model extends CI_Model
return success($writeResult);
}
public function remove($filename)
{
// Check if the property _path represents a valid directory
$checkResult = $this->_checkPath();
if (isError($checkResult)) return $checkResult; // If not then return the error
// Check filename
if (isEmptyString($filename)) return error('The given filename is not valid');
if (unlink($this->_path.DIRECTORY_SEPARATOR.$filename) === true)
{
return success();
}
else
{
return error('An error occurred while removing a file');
}
}
// ------------------------------------------------------------------------------------------------------------------
// Old public methods that work with the base64 encoding, not to be used!