File upload

This commit is contained in:
CHIEFSOFT\ameye
2023-06-02 16:08:59 -04:00
parent 47782693ba
commit 14cab76805
3 changed files with 72 additions and 5 deletions
+15 -3
View File
@@ -6,6 +6,7 @@
include '../../../backend.php';
include 'constants.php';
include 'formarter.php';
include 'UploadManager.php';
$endpoints = array(
'apigate' => array('POST'),
@@ -136,6 +137,19 @@ 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
$raw_json = flatten(json_decode(file_get_contents('php://input'), true));
$raw_array = json_decode($raw_json, true);
$raw_array["call_backend"] = $call_backend;
$ll = reciveUpload($raw_array, $local_out);
$raw_array["call_backend"] = $local_out["call_backend"];
$raw_array["message"] = $local_out["message"];
}
else{
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$in = flatten(json_decode(file_get_contents('php://input'), true));
}
}
// $call_backend = false;
if (isset($_FILES) && is_array($_FILES) && count($_FILES)>0) {
@@ -143,9 +157,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
}
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$in = flatten(json_decode(file_get_contents('php://input'), true));
}
if ($_SERVER["REQUEST_METHOD"] == "PUT") {
parse_str(file_get_contents('php://input'), $in);
}