-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupload.php
74 lines (58 loc) · 2.09 KB
/
upload.php
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
include('dbm.php');
if (isset($_POST['upload'])) {
$file_name = $_FILES['file']['name'];
$temp_name = $_FILES['file']['tmp_name'];
$file_size = $_FILES['file']['size'];
$file_destination = "upload/" . $file_name;
if (move_uploaded_file($temp_name, $file_destination)) {
$q = "INSERT into video (name) VALUES ('$file_name')";
if (mysqli_query($conn, $q)) {
$success = "Video uploaded.";
} else
$failed = "upload failed";
}
} else {
$msg = "Please select a file to upload";
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>UPLOAD_VID</title>
<link rel="stylesheet" type="text/css" href="assets/css/bootstrap.min.css">
</head>
<body>
<div class="container mt-3">
<h1 class="mb-5 text-center">UPLOAD VIDEO </h1>
<div class="col-lg-8 m-auto">
<form action="upload.php" method="post" enctype="multipart/form-data">
<div class="mb-3">
<label class="form-label" for="file">Choose a video to upload </label>
<input type="file" name="file" class="form-control">
</div>
<?php if(isset($success)) { ?>
<div class="alert alert-success">
<?php echo $success?>
</div>
<?php }?>
<?php if(isset($failed)) { ?>
<div class="alert alert-danger">
<?php echo $failed?>
</div>
<?php }?>
<?php if(isset($msg)) { ?>
<div class="alert alert-danger">
<?php echo $msg?>
</div>
<?php }?>
<input type="submit" name="upload" value="Upload" class="btn btn-outline-success "/>
</form>
</div>
</div>
</body>
</html>