ok
Direktori : /home2/selectio/www/caliberembedded.com/admin/add-api/ |
Current File : /home2/selectio/www/caliberembedded.com/admin/add-api/about-add.php |
<?php include "../config/config.php"; if(isset($_POST['add_content'])){ try{ $date = date('Y-m-d h:i:s a', time()); if(isset($_FILES['photo']) && $_FILES["photo"]["name"]!=""){ $extension = end(explode(".", $_FILES["photo"]["name"])); $image = rand(10,1000000000)."-image." . $extension; $upload = move_uploaded_file($_FILES['photo']['tmp_name'], '../images/about/' . $image); $upload_image = 'images/about/' . $image; } else{ $upload_image=''; } $statement = $pdo->prepare("INSERT INTO `tbl_about`(`image`,`title`,`about_description`,`type`) VALUES (?,?,?,?)"); $result=$statement->execute(array($upload_image,$_POST['title'],$_POST['description'],$_POST['about'])); if($result){ $message = 'Content is added successfully!'; unset($_POST); }else{ $warning="Something went wrong try again..."; } }catch(Exception $e){ $error=$e; } } ?>