From 7b94804bff770ea3569781f42dbea58b18d7d823 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Tue, 8 Aug 2023 18:34:32 -0400 Subject: [PATCH] profile my files --- www-api/app/Models/UploadManager.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/www-api/app/Models/UploadManager.php b/www-api/app/Models/UploadManager.php index 844ce375..620db269 100644 --- a/www-api/app/Models/UploadManager.php +++ b/www-api/app/Models/UploadManager.php @@ -30,6 +30,30 @@ class UploadManager extends Model switch ($action){ + case WRENCHBOARD_RESOURCE_MYFILES: + // MAKE SURE FOLDER AS PER PROECESS IS AVILABLE + $thisProfileFolder = $this->savePath.'PROFILE/'.$in["uid"]; + if (!file_exists($thisProfileFolder)) { + mkdir($thisProfileFolder, 0777, true); + } + if (!file_exists($thisProfileFolder."/MYFILES")) { + mkdir($thisProfileFolder."/MYFILES", 0777, true); + } + + $myFilesFolder = $thisProfileFolder."/MYFILES"; + + if (file_exists($myFilesFolder)) { + $tt_d = date('hisjmy'); + $out["message"] = $tt_d."-".$in['file_name']; + $myFilesFolderFileName = $myFilesFolder.'/'.$out["message"]; + $myfile = fopen($myFilesFolderFileName, "w") or die("Unable to open file!"); + $file_data = base64_decode($in["file_data"]); + fwrite($myfile, $file_data); + fclose($myfile); + $out["call_backend"] = true; // flag ready to save data entry + } + break; + case WRENCHBOARD_CONTRACT_MESSAGE: // MAKE SURE FOLDER AS PER PROECESS IS AVILABLE $thisContactFolder = $this->savePath.'CONTRACTS/'.$in["contract"];