-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadd.php
More file actions
39 lines (28 loc) · 1.46 KB
/
Copy pathadd.php
File metadata and controls
39 lines (28 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
include("connection.php");
if(isset($_POST['submit']))
{
$name = mysqli_real_escape_string($con,$_POST['name']);
$id = mysqli_real_escape_string($con,$_POST['id']);
$short = mysqli_real_escape_string($con,$_POST['short']);
$feat = mysqli_real_escape_string($con,$_POST['feat']);
$class = mysqli_real_escape_string($con,$_POST['class']);
$pdf = mysqli_real_escape_string($con,$_POST['pdf']);
$hash = "#";
$mod = "portfolioModal";
$modalid = $mod.$id;
$modal = $hash.$modalid;
$img_name = $_FILES["img"]["name"]; // get the name of the uploaded image file
$img_tmp_name = $_FILES["img"]["tmp_name"]; // get the temporary name of the uploaded image file
// Define the target directory for the uploaded image
$target_dir = "assets/img/products/";
$target_file = $target_dir . basename($img_name); // create the full path of the target file
move_uploaded_file($img_tmp_name, $target_file);
$sql = "insert into prod_tab (name,short,class,img,feat,pdf,id,modal,modid) values ('$name', '$short', '$class', '$img_name','$feat','$pdf','$id','$modal','$modalid')";
if ($con->query($sql) === TRUE) {
header('Location: http://localhost/NextTech/manage_pro.php');
} else {
echo "Error: " . $sql . "<br>" . $con->error;
}
}
?>