<?php /****************************************************************************/ $image = new ImageSlider(); //object of ImageSlader class //print_r($_FILES); if (isset($_POST['add_image'])) { if (isset($_FILES['fup_image'])) { $image->image_slider_subtitle = $_POST['image_slider_subtitle']; $image->image_slider_title = $_POST['image_slider_title']; $image->image_slider_status = $_POST['cb_visibility']; $image_tmp_name = $_FILES['fup_image']['tmp_name']; $image_name = $_FILES['fup_image']['name']; move_uploaded_file($image_tmp_name, "./../img/" . $image_name); $image->image_slider_url = $image_name; $image->insert(); echo "<div class='alert alert-success'> \n <i><strong>Image successfully uploaded. :)</strong></i>\n </div>"; } else { echo "<div class='alert alert-danger'> \n <i><strong>Image not uploaded!!! Incomplete data!!! Try again.</strong></i>\n </div>"; } } print_r($_SESSION); /*****************************************************************************/ ?> <h3>Add new image</h3> <form action="" method="POST" id="login_form" enctype="multipart/form-data" > <label for="subtitle">Image subtitle:</label> <input class="form-control" id="subtitle" name="image_slider_subtitle" placeholder="Image subtitle"> <br> <label for="title">Image title:</label> <input class="form-control" id="title" name="image_slider_title" placeholder="Image title">