Upload engine
This commit is contained in:
@@ -33,4 +33,6 @@ defined('CI_DEBUG') || define('CI_DEBUG', true);
|
||||
|
||||
define('ENV_ID', 'DEVLP20233103-A3');
|
||||
define('HOME_PAGE_BACKGROUND', 'api_bk.jpg');
|
||||
define('CACHE_DOMAIN', 'wrench.dev');
|
||||
define('CACHE_DOMAIN', 'wrench.dev');
|
||||
|
||||
define('WRENCHBOARD_UPLOAD_PATH', '/opt/wrenchboard/TEST/');
|
||||
|
||||
@@ -22,4 +22,6 @@ defined('CI_DEBUG') || define('CI_DEBUG', false);
|
||||
|
||||
define('ENV_ID', 'PRAODUCTIONG20233103-A3');
|
||||
define('HOME_PAGE_BACKGROUND', 'api_bk.jpg');
|
||||
define('CACHE_DOMAIN', 'wrench.prod');
|
||||
define('CACHE_DOMAIN', 'wrench.prod');
|
||||
|
||||
define('WRENCHBOARD_UPLOAD_PATH', '/opt/wrenchboard/LIVE/');
|
||||
@@ -33,4 +33,6 @@ defined('CI_DEBUG') || define('CI_DEBUG', true);
|
||||
|
||||
define('ENV_ID', 'TESTING20233103-A3');
|
||||
define('HOME_PAGE_BACKGROUND', 'api_bk.jpg');
|
||||
define('CACHE_DOMAIN', 'wrench.test');
|
||||
define('CACHE_DOMAIN', 'wrench.test');
|
||||
|
||||
define('WRENCHBOARD_UPLOAD_PATH', '/opt/wrenchboard/TEST/');
|
||||
|
||||
@@ -473,9 +473,9 @@ class WrenchApi extends BaseController
|
||||
$raw_json = file_get_contents('php://input');
|
||||
$raw_array = json_decode($raw_json, true);
|
||||
$raw_array["call_backend"] = $call_backend;
|
||||
$ll = ( new \App\Models\UploadManager() )->reciveUpload($raw_array, $local_out);
|
||||
$call_backend = $local_out["call_backend"];
|
||||
$raw_array["message"] = $local_out["message"];
|
||||
$out = ( new \App\Models\UploadManager() )->reciveUpload($raw_array, $local_out);
|
||||
$call_backend = $out["call_backend"];
|
||||
$raw_array["message"] = $out["message"];
|
||||
}
|
||||
if (isset($_FILES) && is_array($_FILES) && count($_FILES)>0) {
|
||||
$raw_array = array_merge($_POST,$_FILES);
|
||||
|
||||
@@ -5,8 +5,7 @@ use CodeIgniter\Model;
|
||||
|
||||
class UploadManager extends Model
|
||||
{
|
||||
|
||||
public $savePath ="/opt/wrenchboard/TEST/";
|
||||
public $savePath = WRENCHBOARD_UPLOAD_PATH; //"/opt/wrenchboard/TEST/";
|
||||
public function reciveUpload($in,$out){
|
||||
|
||||
$action = $in["action"];
|
||||
@@ -53,7 +52,7 @@ class UploadManager extends Model
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
return $out;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
|
||||
function reciveUpload($in,$out){
|
||||
$savePath ="/opt/wrenchboard/TEST/";
|
||||
function reciveUpload($in, $out){
|
||||
$savePath = WRENCHBOARD_UPLOAD_PATH; //"/opt/wrenchboard/TEST/";
|
||||
$action = $in["action"];
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ function reciveUpload($in,$out){
|
||||
|
||||
case WRENCHBOARD_CONTRACT_MESSAGE:
|
||||
// MAKE SURE FOLDER AS PER PROECESS IS AVILABLE
|
||||
$out["call_backend"] = false; // flag ready to save data entry
|
||||
$thisContactFolder = $savePath.'CONTRACTS/'.$in["contract"];
|
||||
if (!file_exists($thisContactFolder)) {
|
||||
mkdir($thisContactFolder, 0777, true);
|
||||
@@ -66,7 +67,7 @@ function reciveUpload($in,$out){
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
return $out;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -137,13 +137,13 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
if ( $endpoint == 'uploads'){
|
||||
$local_out=["test_msg"=>'Yes the upload endpoint was hit******** 777'];
|
||||
$call_backend = false; // will be decided after file is saved
|
||||
|
||||
//$out=[];
|
||||
$in = flatten(json_decode(file_get_contents('php://input'), true));
|
||||
//$in = json_decode($raw_json, true);
|
||||
$in["call_backend"] = $call_backend;
|
||||
$ll = reciveUpload($in, $local_out);
|
||||
$call_backend = $local_out["call_backend"];
|
||||
$in["message"] = $local_out["message"];
|
||||
$out = reciveUpload($in, $local_out);
|
||||
$call_backend = $out["call_backend"];
|
||||
$in["message"] = $out["message"];
|
||||
|
||||
}
|
||||
else{
|
||||
|
||||
Reference in New Issue
Block a user