Aerror management on uploads

This commit is contained in:
CHIEFSOFT\ameye
2023-12-16 07:29:15 -05:00
parent 7d07ecb91d
commit 112d24e2b2
+7
View File
@@ -546,6 +546,8 @@ class WrenchApi extends BaseController
$local_out =[]; $local_out =[];
if ($_SERVER["REQUEST_METHOD"] == "POST") { // if upload lets modify all the data if ($_SERVER["REQUEST_METHOD"] == "POST") { // if upload lets modify all the data
if ( $endpoint == 'uploads'){ if ( $endpoint == 'uploads'){
try {
log_message('critical', "ENDPOINT TESTING UPLOAD-> ".$endpoint ); log_message('critical', "ENDPOINT TESTING UPLOAD-> ".$endpoint );
$local_out=["test_msg"=>'Yes the upload endpoint was hit********']; $local_out=["test_msg"=>'Yes the upload endpoint was hit********'];
$call_backend = false; // will be decided after file is saved $call_backend = false; // will be decided after file is saved
@@ -558,6 +560,11 @@ class WrenchApi extends BaseController
$call_backend = $out["call_backend"]; $call_backend = $out["call_backend"];
$in["message"] = $raw_array["message"] = $out["message"]; $in["message"] = $raw_array["message"] = $out["message"];
$raw_array["file_data"] = $out['file_data'] = $in['file_data'] =""; // no need to carry raw file data anymore - saved or cached ath this point $raw_array["file_data"] = $out['file_data'] = $in['file_data'] =""; // no need to carry raw file data anymore - saved or cached ath this point
} catch (Exception $e) {
$error = 'Caught exception: '. $e->getMessage();
log_message('critical', "ERROR ENDPOINT TESTING UPLOAD-> ".$error );
}
} }
if (isset($_FILES) && is_array($_FILES) && count($_FILES)>0) { if (isset($_FILES) && is_array($_FILES) && count($_FILES)>0) {
$raw_array = array_merge($_POST,$_FILES); $raw_array = array_merge($_POST,$_FILES);