/
var
/
www
/
html
/
admin
/
Upload FileeE
HOME
<?php session_start(); include('../includes/config.php'); if(strlen($_SESSION['alogin'])==0) { header('location:index.php'); } else{ if(isset($_POST['submit'])) { $category=$_POST['category']; $subcat=$_POST['subcategory']; $productname=$_POST['productName']; $productcompany=$_POST['productCompany']; $productprice=$_POST['productprice']; $productpricebd=$_POST['productpricebd']; $productdescription=$_POST['productDescription']; $productscharge=$_POST['productShippingcharge']; $sku=$_POST['sku']; $productavailability=$_POST['productAvailability']; $productimage1=$_FILES["productimage1"]["name"]; $productimage2=$_FILES["productimage2"]["name"]; $productimage3=$_FILES["productimage3"]["name"]; $productimage4=$_FILES["productimage4"]["name"]; $productimage5=$_FILES["productimage5"]["name"]; $productimage6=$_FILES["productimage6"]["name"]; //for getting product id $query=mysqli_query($con,"select max(id) as pid from products"); $result=mysqli_fetch_array($query); $productid=$result['pid']+1; $dir="productimages/$productid"; mkdir($dir);// directory creation for product images move_uploaded_file($_FILES["productimage1"]["tmp_name"],"productimages/$productid/".$_FILES["productimage1"]["name"]); move_uploaded_file($_FILES["productimage2"]["tmp_name"],"productimages/$productid/".$_FILES["productimage2"]["name"]); move_uploaded_file($_FILES["productimage3"]["tmp_name"],"productimages/$productid/".$_FILES["productimage3"]["name"]); move_uploaded_file($_FILES["productimage4"]["tmp_name"],"productimages/$productid/".$_FILES["productimage4"]["name"]); move_uploaded_file($_FILES["productimage5"]["tmp_name"],"productimages/$productid/".$_FILES["productimage5"]["name"]); move_uploaded_file($_FILES["productimage6"]["tmp_name"],"productimages/$productid/".$_FILES["productimage6"]["name"]); $sql=mysqli_query($con,"insert into products(category,subCategory,productName,sku,productCompany,productPrice,productDescription,shippingCharge,productAvailability,productImage1,productImage2,productImage3,productImage4,productImage5,productImage6,productPriceBeforeDiscount) values('$category','$subcat','$productname','$sku','$productcompany','$productprice','$productdescription','$productscharge','$productavailability','$productimage1','$productimage2','$productimage3','$productimage4','$productimage5','$productimage6','$productpricebd')"); $_SESSION['msg']="Product Inserted Successfully !!"; } ?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <meta charset="utf-8" /> <title>Tables - Ace Admin</title> <meta name="description" content="Static & Dynamic Tables" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" /> <!-- bootstrap & fontawesome --> <link rel="stylesheet" href="assets/css/bootstrap.min.css" /> <link rel="stylesheet" href="assets/font-awesome/4.5.0/css/font-awesome.min.css" /> <!-- page specific plugin styles --> <!-- text fonts --> <link rel="stylesheet" href="assets/css/fonts.googleapis.com.css" /> <!-- ace styles --> <link rel="stylesheet" href="assets/css/ace.min.css" class="ace-main-stylesheet" id="main-ace-style" /> <!--[if lte IE 9]> <link rel="stylesheet" href="assets/css/ace-part2.min.css" class="ace-main-stylesheet" /> <![endif]--> <link rel="stylesheet" href="assets/css/ace-skins.min.css" /> <link rel="stylesheet" href="assets/css/ace-rtl.min.css" /> <!--[if lte IE 9]> <link rel="stylesheet" href="assets/css/ace-ie.min.css" /> <![endif]--> <!-- inline styles related to this page --> <!-- ace settings handler --> <script src="assets/js/ace-extra.min.js"></script> <!-- HTML5shiv and Respond.js for IE8 to support HTML5 elements and media queries --> <!--[if lte IE 8]> <script src="assets/js/html5shiv.min.js"></script> <script src="assets/js/respond.min.js"></script> <![endif]--> </head> <body class="no-skin"> <?php include("topheader.php");?> <div class="main-container ace-save-state" id="main-container"> <script type="text/javascript"> try{ace.settings.loadState('main-container')}catch(e){} </script> <?php include("leftheader.php");?> <div class="main-content"> <div class="main-content-inner"> <div class="page-content"> <div class="row"> <div class="col-xs-12"> <!-- PAGE CONTENT BEGINS --> <div class="hr hr-18 dotted hr-double"></div> <div class="row"> <div class="col-xs-12"> <div class="module-head"> <h3><span class="widget-toolbar"> <?php if(isset($_POST['submit'])) {?> <div class="alert alert-success"> <button type="button" class="close" data-dismiss="alert">×</button> <strong>Well done!</strong> <?php echo htmlentities($_SESSION['msg']);?><?php echo htmlentities($_SESSION['msg']="");?> </div> <?php } ?> <?php if(isset($_GET['del'])) {?> <div class="alert alert-error"> <button type="button" class="close" data-dismiss="alert">×</button> <strong>Oh snap!</strong> <?php echo htmlentities($_SESSION['delmsg']);?><?php echo htmlentities($_SESSION['delmsg']="");?> </div> <?php } ?> </span></h3> </div> <div class="row"> <div class="col-xs"> <div class="col-xs-12 "> <div class="widget-box"> <div class="widget-header"> Insert Product </div> <div class="widget-body"> <div class="widget-main"> <form class="form-horizontal row-fluid" name="insertproduct" method="post" style="padding:30px;font-size:18px;line-height:35px" enctype="multipart/form-data"> <div> <label for="form-field-select-1">Category</label> <select name="category" class="form-control" id="form-field-select-1" onChange="getSubcat(this.value);" required> <option value="">Select Category</option> <?php $query=mysqli_query($con,"select * from category"); while($row=mysqli_fetch_array($query)) {?> <option value="<?php echo $row['id'];?>"><?php echo $row['categoryName'];?></option> <?php } ?> </select> </div> <div> <script> function getSubcat(val) { $.ajax({ type: "POST", url: "get_subcat.php", data:'cat_id='+val, success: function(data){ $("#subcategory").html(data); } }); } function selectCountry(val) { $("#search-box").val(val); $("#suggesstion-box").hide(); } </script> <label for="form-field-select-1">Sub Category</label> <select name="subcategory" id="subcategory" class="form-control" required> </select> </div> <div> <label for="form-field-select-1"> Product Name (عربي) </label> <input type="text" name="productName" placeholder="Enter Product Name" class="form-control" required> </div> <div> <label for="form-field-select-1"> Product Name (Englsih) </label> <input type="text" name="productNamee" placeholder="Enter Product Name" class="form-control" required> </div> <div> <label for="form-field-select-1"> Product SKU Number </label> <input type="text" name="sku" placeholder="Enter Product Name" class="form-control" required> </div> <div> <label for="form-field-select-1"> Product Company(عربي)</label> <input type="text" name="productCompany" placeholder="Enter Product Comapny Name" class="form-control" required> </div> <div> <label for="form-field-select-1"> Product Company(Englsih)</label> <input type="text" name="productCompanye" placeholder="Enter Product Comapny Name" class="form-control" required> </div> <div> <label for="form-field-select-1"> Product Price <mark>Before Discount</mark> </label> <input type="text" name="productpricebd" placeholder="Enter Product Price" class="form-control" required> </div> <div> <label for="form-field-select-1"> Product Price <mark>After Discount(Selling Price)</mark> </label> <input type="text" name="productprice" placeholder="Enter Product Price" class="form-control" value="0" required> </div> <div> <label for="form-field-select-1"> Product Description(عربي) </label> <textarea name="productDescription" placeholder="Enter Product Description" rows="6" class="form-control"> </textarea> </div> <div> <label for="form-field-select-1"> Product Description(Englsih) </label> <textarea name="productDescriptione" placeholder="Enter Product Description" rows="6" class="form-control"> </textarea> </div> <div style="display:none"> <label for="form-field-select-1"> Product Shipping Charge </label> <input type="hidden" name="productShippingcharge" value="0" placeholder="Enter Product Shipping Charge" class="form-control" required> </div> <div> <label for="form-field-select-1"> Product Availability</label> <select name="productAvailability" id="productAvailability" class="form-control" required> <option value="">Select</option> <option value="In Stock">In Stock</option> <option value="Out of Stock">Out of Stock</option> </select> </div> <div> <label for="form-field-select-1"> Vedio Link</label> <input type="url" name="vedio" placeholder="Enter Vedio Link" class="form-control" > </div> <div> <label for="form-field-select-1"> Product Image1 </label> <input type="file" name="productimage1" id="productimage1" value="" class="form-control" required> </div> <div> <label for="form-field-select-1"> Product Image2 </label> <input type="file" name="productimage2" class="form-control" required> </div> <div> <label for="form-field-select-1"> Product Image3 </label> <input type="file" name="productimage3" class="form-control" required> <label for="form-field-select-1"> Product Image4 </label> <input type="file" name="productimage4" class="form-control" > <label for="form-field-select-1"> Product Image5 </label> <input type="file" name="productimage5" class="form-control" > <label for="form-field-select-1"> Product Image6 </label> <input type="file" name="productimage6" class="form-control" > </div> </div> </div> </div> <div class="clearfix form-actions"> <div class="col-md-offset-3 col-md-9"> <button type="submit" name="submit" class="btn">Insert</button> </form> </div> </div> </div><!-- /.span --> </div><!-- /.row --> </div> <script src="scripts/jquery-1.9.1.min.js" type="text/javascript"></script> <script src="scripts/jquery-ui-1.10.1.custom.min.js" type="text/javascript"></script> <script src="bootstrap/js/bootstrap.min.js" type="text/javascript"></script> <script src="scripts/flot/jquery.flot.js" type="text/javascript"></script> <script src="scripts/datatables/jquery.dataTables.js"></script> <script> $(document).ready(function() { $('.datatable-1').dataTable(); $('.dataTables_paginate').addClass("btn-group datatable-pagination"); $('.dataTables_paginate > a').wrapInner('<span />'); $('.dataTables_paginate > a:first-child').append('<i class="icon-chevron-left shaded"></i>'); $('.dataTables_paginate > a:last-child').append('<i class="icon-chevron-right shaded"></i>'); } ); </script> </body> <?php } ?>