Example #1
0
if (isset($_POST['productname'])) {
    $productToAdd = $_POST['productname'];
    Product::createProduct($productName, $productPrice, $productDescription, $productStock, $productGroup);
}
//zarzadzanie obrazkami
if (isset($_FILES['imageToLoad'])) {
    $imageToLoad = $_FILES['imageToLoad'];
    $dir = dirname(__FILE__);
    $uploadDir = $dir . '/product_image';
    $fileName = $imageToLoad['name'];
    $tmp_name = $imageToLoad['tmp_name'];
    $fileDir = $uploadDir . '/' . $fileName;
    move_uploaded_file($tmp_name, $fileDir);
    if (isset($_POST['image_product'])) {
        $productName = $_POST['image_product'];
        $ret = Product::getProductObjectbyName($productName);
        $productId = $ret[0]->getId();
        $newImage = Image::AddImage($productId, $fileDir);
    }
}
?>


<div class="container">
    <div style="height: 75px;"></div>

    <div class="row">
        <div class="col-sm-2"></div>
        <div class="col-sm-8">
            <div class="row">
                <div class="col-sm-12">