Revert "More work and troubleshooting image upload"

This reverts commit 0a78c4fddc.
This commit is contained in:
sctn4elk 2024-05-15 18:15:55 -05:00
parent 0a78c4fddc
commit 0cecde088c
10 changed files with 20 additions and 22 deletions

View File

@ -1,11 +1,12 @@
<?php
header("Content-Type: application/json");
define('PD', 'D:\DEV\Git Repository\CustomerRewardsRESTAPI');
require_once PD . "/Model/CustomerModel.php";
/**
* Description of CustomerController
*
* @author Mike Howard
* @author SCTN4
* http://localhost:8000/index.php/customer/process/insert?name=Mike%20Howard&email=sctn4elk@msn.com&phone=208-841-4159&birthday=05/07/1965&loyalty=1&city=Winnsboro&state=TX&zip=75494
* http://localhost:8000/index.php/customer/process/select?limit=20
*/

View File

@ -3,12 +3,13 @@ header("Content-Type: application/json");
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: POST");
define('PD', 'D:\DEV\Git Repository\CustomerRewardsRESTAPI');
require_once PD . "/Model/ImageModel.php";
/**
* Description of ImageController
*
* @author Mike Howard
* @author SCTN4
*/
class ImageController extends BaseController {
@ -71,13 +72,12 @@ class ImageController extends BaseController {
}
/* Upload the image and store on server as file */
private function uploadImage() {
if ($this->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();

View File

@ -8,7 +8,7 @@ header("Content-Type: application/json");
/**
* Description of PurchaseController
*
* @author Mike Howard
* @author SCTN4
*/
class PurchaseController extends BaseController{
/**

View File

@ -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';

View File

@ -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]);

View File

@ -2,7 +2,7 @@
/**
* Description of Database
*
* @author Mike Howard
* @author SCTN4
*/
class Database {
protected $connection = null;

View File

@ -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');
}

View File

@ -3,7 +3,7 @@
/**
* Description of ModelTraits
*
* @author Mike Howard
* @author SCTN4
*/
trait ModelTraits {
private $params = array();

View File

@ -8,7 +8,7 @@
/**
* Description of PurchaseModel
*
* @author Mike Howard
* @author SCTN4
*/
require_once PROJECT_ROOT_PATH . "/Model/Database.php";

View File

@ -1,4 +1,3 @@
auxiliary.org-netbeans-modules-php-smarty.smarty-framework=true
browser.reload.on.save=true
code.analysis.excludes=
ignore.path=