Changed to contractqueue and contract
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user