<?php require_once "phpuploader/include_phpuploader.php"; ?> <?php $uploader = new PhpUploader(); $mvcfile = $uploader->GetValidatingFile(); if ($mvcfile->FileName == "accord.bmp") { $uploader->WriteValidationError("My custom error : Invalid file name. "); exit(200); } //USER CODE: $productId = $_REQUEST["proId"]; $imageType = $_REQUEST["imgType"]; $savefilepath = "data/" . $productId . "_" . $imageType . "." . substr(strrchr($mvcfile->FileName, '.'), 1); $targetfilepath = "../../" . $savefilepath; if (is_file($targetfilepath)) { unlink($targetfilepath); } $mvcfile->MoveTo($targetfilepath); $uploader->WriteValidationOK(); require_once "../../controller/ProductImageController.php"; ProductImageController::Update($productId, $imageType, $savefilepath); ?>
require_once "../utils/product_util.php"; $id = $_REQUEST["id"]; $result = ProductController::Delete($id); if ($result) { echo ProductUtil::createMessageBox("DELETE PRODUCT", "Delete completed!"); } else { echo ProductUtil::createMessageBox("DELETE PRODUCT", "Delete does not complete!"); } } else { if (isset($_REQUEST["action"]) && $_REQUEST["action"] == "deleteImage") { include_once "../../../controller/ProductImageController.php"; require_once "../utils/product_util.php"; $id = $_REQUEST["proId"]; $imgType = $_REQUEST["imgType"]; $img = ProductImageController::GetImageOfProductFromProductID($id); $result = ProductImageController::Update($id, $imgType, ""); $result = true; if ($result) { if (unlink("../../../" . $img[$imgType])) { echo ProductUtil::createMessageBox("DELETE IMAGE", "Delete completed!"); return; } } echo ProductUtil::createMessageBox("DELETE IMAGE", "Delete does not complete!"); } } } } if (isset($_REQUEST["action"]) && $_REQUEST["action"] == "search") { $name = $_REQUEST["name"]; $type = $_REQUEST["type"];