From 0cecde088c1e79a39fa9e6fcec6bf4eb9b958361 Mon Sep 17 00:00:00 2001 From: sctn4elk Date: Wed, 15 May 2024 18:15:55 -0500 Subject: [PATCH] Revert "More work and troubleshooting image upload" This reverts commit 0a78c4fddc663e67c5b180536d96c37075d3fd99. --- Controller/API/CustomerController.php | 3 ++- Controller/API/ImageController.php | 12 ++++++------ Controller/API/PurchaseController.php | 2 +- Include/bootstrap.php | 6 +++--- Model/CustomerModel.php | 10 ++++------ Model/Database.php | 2 +- Model/ImageModel.php | 2 +- Model/ModelTraits.php | 2 +- Model/PurchaseModel.php | 2 +- nbproject/project.properties | 1 - 10 files changed, 20 insertions(+), 22 deletions(-) diff --git a/Controller/API/CustomerController.php b/Controller/API/CustomerController.php index 0fb8c5e..2a124e5 100644 --- a/Controller/API/CustomerController.php +++ b/Controller/API/CustomerController.php @@ -1,11 +1,12 @@ checkRequestType('GET') == 'false') { + private function uploadImage(){ + if ($this->checkRequestType('POST') == 'false') { return $this->unprocessableRequestResponse(); } - return var_dump(file_get_contents('php://input')); - $this->imagePayload = file_get_contents($_FILES['image']['tmp_name']); + $this->imagePayload = file_get_contents($_FILES['image']['tmp_name']); $this->imageModel->fileName = $_FILES['image']['name']; if(empty($this->imageModel->fileName)){ return $this->notFoundResponse(); diff --git a/Controller/API/PurchaseController.php b/Controller/API/PurchaseController.php index 91ac74c..7124f6c 100644 --- a/Controller/API/PurchaseController.php +++ b/Controller/API/PurchaseController.php @@ -8,7 +8,7 @@ header("Content-Type: application/json"); /** * Description of PurchaseController * - * @author Mike Howard + * @author SCTN4 */ class PurchaseController extends BaseController{ /** diff --git a/Include/bootstrap.php b/Include/bootstrap.php index fa44429..c70be54 100644 --- a/Include/bootstrap.php +++ b/Include/bootstrap.php @@ -6,12 +6,12 @@ */ define("PROJECT_ROOT_PATH", __DIR__ . "/../"); -//define('PD', 'D:\DEV\Git Repository\CustomerRewardsRESTAPI'); -define('PD', 'C:\DEV\UniServerZ\www\CustomerRewardsRESTAPI'); // include main configuration file require_once PROJECT_ROOT_PATH . "/include/config.php"; // include the base controller file require_once PROJECT_ROOT_PATH . "/Controller/Api/BaseController.php"; +// include the use model file +//require_once PROJECT_ROOT_PATH . "/Model/CustomerModel.php"; +//require_once PROJECT_ROOT_PATH . "/Model/ImageModel.php"; // include the tests autoloader when in development //require_once __DIR__ . '/../vendor/autoload.php'; - diff --git a/Model/CustomerModel.php b/Model/CustomerModel.php index 66c384c..fa03b56 100644 --- a/Model/CustomerModel.php +++ b/Model/CustomerModel.php @@ -11,27 +11,25 @@ * customer_email varchar(255) * customer_phone varchar(12) * customer_birthday datetime - * customer_street varchar(255) + * customer_street varchar(255) * address_code_id bigint * loyalty_member tinyint * - * address_code + * address_code * address_code_id bigint AI PK * address_city varchar(45) * address_state varchar(45) * address_zip varchar(10) */ +define('PD', 'D:\DEV\Git Repository\CustomerRewardsRESTAPI'); +//require_once PROJECT_ROOT_PATH . "/Model/Database.php"; require_once PD . "/Model/Database.php"; require_once PD . "/Model/ModelTraits.php"; class CustomerModel extends Database { use ModelTraits; - function __construct() { - parent::__construct(); - } - public function findAllCustomers() { return $this->processQuery("SELECT * FROM customer_view ORDER BY customer_id ASC LIMIT ?", ["i", $this->limit]); diff --git a/Model/Database.php b/Model/Database.php index faff114..a807a3c 100644 --- a/Model/Database.php +++ b/Model/Database.php @@ -2,7 +2,7 @@ /** * Description of Database * - * @author Mike Howard + * @author SCTN4 */ class Database { protected $connection = null; diff --git a/Model/ImageModel.php b/Model/ImageModel.php index 877c5ca..0035bd2 100644 --- a/Model/ImageModel.php +++ b/Model/ImageModel.php @@ -14,6 +14,7 @@ * loyalty_value_blob blob */ +define('PD', 'D:\DEV\Git Repository\CustomerRewardsRESTAPI'); require_once PD . "/Model/Database.php"; require_once PD . "/Model/ModelTraits.php"; @@ -29,7 +30,6 @@ class ImageModel extends Database { public $fileType; function __construct() { - parent::__construct(); $this->uploadTo = "public/images/"; $this->allowFileType = array('jpg','png','jpeg','gif'); } diff --git a/Model/ModelTraits.php b/Model/ModelTraits.php index 89f0402..8a48042 100644 --- a/Model/ModelTraits.php +++ b/Model/ModelTraits.php @@ -3,7 +3,7 @@ /** * Description of ModelTraits * - * @author Mike Howard + * @author SCTN4 */ trait ModelTraits { private $params = array(); diff --git a/Model/PurchaseModel.php b/Model/PurchaseModel.php index 49097b5..1ce2ad7 100644 --- a/Model/PurchaseModel.php +++ b/Model/PurchaseModel.php @@ -8,7 +8,7 @@ /** * Description of PurchaseModel * - * @author Mike Howard + * @author SCTN4 */ require_once PROJECT_ROOT_PATH . "/Model/Database.php"; diff --git a/nbproject/project.properties b/nbproject/project.properties index bb05833..ff962db 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -1,4 +1,3 @@ -auxiliary.org-netbeans-modules-php-smarty.smarty-framework=true browser.reload.on.save=true code.analysis.excludes= ignore.path=