-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupload.php
More file actions
59 lines (36 loc) · 1.58 KB
/
upload.php
File metadata and controls
59 lines (36 loc) · 1.58 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
include ('config.php');
@ob_start();
session_start();
$userid=$_SESSION["user_id"];
$target_dir = "images/$userid/";
//$target_file = $target_dir . basename($_FILES["files"]["name"]);
if(is_array($_FILES))
{
$title=$_POST['title'];
$theme=$_POST['theme'];
$soundtrack=$_POST['sound'];
$cat=$_POST['cat'];
$sql="INSERT INTO user_tb_movie_254 (title, category, theme,sound)
VALUES ('$title','$cat','$theme','$soundtrack')";
$result=mysqli_query($conn,$sql);
if($result){
$last_id = mysqli_insert_id($conn);
// $file_main="$target_dir"."/".pathinfo($_FILES['files']['name'], PATHINFO_FILENAME);
foreach($_FILES["files"]["tmp_name"] as $key=>$tmp_name){
// move_uploaded_file($_FILES["files"]["tmp_name"], $target_file);
$temp = $_FILES["files"]["tmp_name"][$key];
// $name = $_FILES["files"]["name"][$key];
$target_file = $target_dir . basename($_FILES["files"]["name"][$key]);
move_uploaded_file($temp,$target_file);
$sql="INSERT INTO user_tb_movie_img_254 (img_path, movie_id) VALUES('$target_file ','$last_id') ";
$result=mysqli_query($conn,$sql);
}
if ($result) {
$sql="INSERT INTO user_tb_user_movie_254 (user_id,movie_id) VALUES('$userid','$last_id')";
$result=mysqli_query($conn,$sql);
}
header("Location: mymovies.php?id=".$last_id);
}
// header("Location: mymovies.php?res=".$result);
}