Changed to contractqueue and contract

This commit is contained in:
Frank Schubert
2024-08-01 20:45:44 +02:00
parent 489d081d35
commit 840c5b6f2a
9 changed files with 282 additions and 38 deletions

View File

@@ -9,7 +9,26 @@ class File extends mfBaseModel {
}
protected function beforeSave() {
if($this->mimetype) {
return true;
}
$this->mimetype = $this->getMimetype();
}
public function getMimetype() {
if(!$this->store_filename) return false;
$filepath = $this->getFullPath();
if(!file_exists($filepath)) return false;
$finfo = new finfo(FILEINFO_MIME_TYPE);
$mime = $finfo->file($filepath);
return $mime;
}
public function delete() {
if($this->id) {
$id = $this->id;
@@ -41,9 +60,9 @@ class File extends mfBaseModel {
}
public function getFullPath() {
if(!is_numeric($this->id) || $this->id < 1) {
/*if(!is_numeric($this->id) || $this->id < 1) {
throw new Exception("File not found", 4040);
}
}*/
$filename = $this->store_filename;
$path = MFUPLOAD_FILE_SAVE_PATH;