D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
lampp
/
htdocs
/
admin
/
Filename :
upload.php
back
Copy
<?php require_once ('db.php'); if (isset($_POST['Submit'])) { // echo ""; // }else{ // $file=$_FILES['image']['tmp_name']; // $image = $_FILES["image"] ["name"]; // $image_name= addslashes($_FILES['image']['name']); // $size = $_FILES["image"] ["size"]; // $error = $_FILES["image"] ["error"]; // // if ($error > 0){ // die("Error uploading file! Code $error."); // }else{ // if($size > 10000000) //conditions for the file // { // die("Format is not allowed or file size is too big!"); // } // // else // { move_uploaded_file($_FILES["product_img"]["tmp_name"],"uploads/" . $_FILES["product_img"]["name"]); $product_img = $_FILES["product_img"]["name"]; $product_title=$_POST['product_title']; $product_desc=$_POST['product_desc']; $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $sql = "INSERT INTO add_product (product_title, product_desc, product_img) VALUES ('$product_title', '$product_desc', '$product_img')"; $conn->exec($sql); echo "<script>alert('Successfully Added!!!'); window.location='index.php'</script>"; // } } // } ?>