<?php require_once __DIR__ . '/../common/autoload_cms.php'; if ($_SERVER['REQUEST_METHOD'] === 'POST') { $entity = new ProductImage(); $entity->setName($_POST['name'])->setProductId($_GET['product_id'])->setDateAdded(date('Y-m-d H:i:s'))->saveImage($_FILES['image']); $productImageCollection = new ProductImageCollection(); $productImageCollection->save($entity); header('Location: product_image_list.php?product_id=' . $_GET['product_id']); exit; } require_once 'include/header.php'; ?> <div class="container"> <form method="post" action="" enctype="multipart/form-data"> <div class="form-group"> <label for="name">Name:</label> <input type="text" name="name" id="name" class="form-control"> </div> <div class="form-group"> <label for="image">Image:</label> <input type="file" name="image" id="image" class="form-control"> </div> <button type="submit" class="btn btn-default">Submit</button> </form> </div> <?php