54 lines
1.4 KiB
PHP
54 lines
1.4 KiB
PHP
<?php
|
|
|
|
|
|
function reciveUpload($in,$out){
|
|
$savePath ="/opt/wrenchboard/TEST/";
|
|
$action = $in["action"];
|
|
|
|
|
|
//DECIDE IF PARENT FOLDER IS PRESENT
|
|
if (!file_exists($savePath.'CONTRACTS')) {
|
|
mkdir($savePath.'CONTRACTS', 0777, true);
|
|
}
|
|
|
|
if (!file_exists($savePath.'PROFILE')) {
|
|
mkdir($savePath.'PROFILE', 0777, true);
|
|
}
|
|
|
|
if (!file_exists($savePath.'JOBS')) {
|
|
mkdir($savePath.'JOBS', 0777, true);
|
|
}
|
|
|
|
switch ($action){
|
|
|
|
case WRENCHBOARD_CONTRACT_MESSAGE:
|
|
// MAKE SURE FOLDER AS PER PROECESS IS AVILABLE
|
|
$thisContactFolder = $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 0;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
?>
|