upload job oicture
This commit is contained in:
@@ -10,6 +10,7 @@ enum { PARTNER_STRIPE };
|
||||
#define WRENCH_FILE_MYFILE 200
|
||||
#define WRENCH_FILE_CONTRACTS 300
|
||||
#define WRENCH_FILE_FAMILY 400
|
||||
#define WRENCH_FILE_JOB 500
|
||||
|
||||
#define PHP_API_OK 0
|
||||
#define PHP_CREATED_OK 10
|
||||
|
||||
@@ -80,6 +80,44 @@ class UploadManager extends Model
|
||||
}
|
||||
break;
|
||||
|
||||
case WRENCHBOARD_PICTURE_JOB:
|
||||
|
||||
if ( trim($in["uid"]) == ''){
|
||||
$out["error_msg"] = "invalid_upload_call";
|
||||
$out["call_backend"] = false; // something went bad
|
||||
return -1;
|
||||
}
|
||||
// MAKE SURE FOLDER AS PER PROCESS IS AVAILABLE
|
||||
$thisProfileFolder = $this->savePath.'PROFILE/'.$in["uid"];
|
||||
if (!file_exists($thisProfileFolder)) {
|
||||
mkdir($thisProfileFolder, 0777, true);
|
||||
}
|
||||
if (!file_exists($thisProfileFolder."/JOBS")) {
|
||||
mkdir($thisProfileFolder."/JOBS", 0777, true);
|
||||
}
|
||||
|
||||
$myFilesFolder = $thisProfileFolder."/JOBS";
|
||||
|
||||
if (file_exists($myFilesFolder)) {
|
||||
//$tt_d = date('hisjmy');
|
||||
$out["message"] = "completed";
|
||||
$pieces = explode(".", $in['file_name']);
|
||||
$in['profile'] = "profile.".$pieces[1];
|
||||
$myFilesFolderFileName = $myFilesFolder.'/'. $in['profile'];
|
||||
$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"] = false; // flag ready to save data entry
|
||||
$data['uid'] =$in["uid"];
|
||||
$data['sessionid'] =$in["sessionid"];
|
||||
$data['profile'] = $in["profile"];
|
||||
$data['member_id'] = $in["member_id"];
|
||||
$data['file_section'] = WRENCH_FILE_JOB;
|
||||
$out['upload_result'] = $this->specififBackendCall(WRENCHBOARD_SAVE_MEDIA,$data);
|
||||
}
|
||||
break;
|
||||
|
||||
case WRENCHBOARD_PICTURE_FAMMEMBER:
|
||||
if ( trim($in["uid"]) == '' && trim($in["family_uid"]) == ''){
|
||||
$out["error_msg"] = "invalid_upload_call";
|
||||
|
||||
Reference in New Issue
Block a user