savePath = $in["system_primary_uploads"]; $action = $in["action"]; //DECIDE IF PARENT FOLDER IS PRESENT if (!file_exists($this->savePath.'CONTRACTS')) { mkdir($this->savePath.'CONTRACTS', 0777, true); } if (!file_exists($this->savePath.'PROFILE')) { mkdir($this->savePath.'PROFILE', 0777, true); } if (!file_exists($this->savePath.'FAMILY')) { mkdir($this->savePath.'FAMILY', 0777, true); } if (!file_exists($this->savePath.'JOBS')) { mkdir($this->savePath.'JOBS', 0777, true); } switch ($action){ case WRENCHBOARD_CONTRACT_MESSAGE: // MAKE SURE FOLDER AS PER PROECESS IS AVILABLE $thisContactFolder = $this->savePath.'CONTRACTS/'.$in["contract"]; if (!file_exists($thisContactFolder)) { mkdir($thisContactFolder, 0777, true); } if (file_exists($thisContactFolder)) { $tt_d = date('hisjmy'); $out["message"] = $tt_d."-".$in['file_name']; $thisContactFolderFileName = $thisContactFolder.'/'.$out["message"]; $myfile = fopen($thisContactFolderFileName, "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; } return $out; } } /* * * 'message' => string 'Lorem Ipsum comes from a latin text written in 45BC by Roman statesman, lawyer, scholar, and philosopher, Marcus Tullius Cicero' (length=127) 'msg_type' => string * 'member_id' => int 1 'sessionid' => string '9739747631A235F6C316F1BC8C7D823D873B5DAEB7922750AECFE1E887E4D3A9' (length=64) 'uid' => string '3119b744-42ad-4834-bb83-b737588754ca' (length=36) 'file_name' => string 'international-user.svg' (length=22) 'file_size' => int 1421 'file_type' => string 'image/svg+xml' (length=13) 'file_data' => string 'PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0OCA0OCIgaWQ9IkludGVybmF0aW9uYWxVc2VyIj48cGF0aCBmaWxsPSIjZTZlN2Y5IiBkPSJNMzguNSAzMS4xYzIuMS0xLjEgMy45LTIuNSA1LjQtNC40aC0zLjJjLS42IDEuNi0xLjMgMy4xLTIuMiA0LjR6bS01LjggMS40YzItLjcgMy43LTIuOCA0LjktNS44aC00Ljl2NS44em04LjgtOC42aDQuMmMuOS0xLjggMS41LTMuNyAxLjctNS44aC01LjFjLS4xIDItLjQgNC0uOCA1Ljh6bTIuNC0xNy4zYy0xLjUtMS44LTMuMy0zLjMtNS40LTQuNC44IDEuMiAxLjYgMi43IDIuMiA0LjRoMy4yem0tNS4zIDIuOWgtNS45djUuOGg2LjdjLS4xLTIuMS0uNC00LjEtLjgtNS44em0zLjcgNS44'... (length=1896) 'msg_type' => string 'FILE' (length=4) 'contract' => string '49BWBRW738' (length=10) 'action' => int 14010 /var/www/html/public/wrenchboard/uploads.php:48:null */