-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathupload.php
More file actions
83 lines (65 loc) · 1.83 KB
/
upload.php
File metadata and controls
83 lines (65 loc) · 1.83 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
session_start();
include('connect.php');
?>
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Insert PDF</title>
<style media="screen">
div {
border: 2px solid black;
width: 500px;
margin-left: 370px;
margin-top: 50px;
padding: 30px;
}
form {
margin-left: 70px;
}
label {
font-size: 25px;
font-weight: bold;
}
#pdf {
font-size: 20px;
font-weight: bold;
margin-top: 10px;
}
#upload {
font-size: 20px;
font-weight: bold;
margin-left: 100px;
}
</style>
</head>
<body>
<div class="">
<form class="" action="upload.php" method="post" enctype="multipart/form-data">
<label for="">Choose Your PDF File</label><br>
<input id="pdf" type="file" name="pdf" value="" required><br><br>
<input id="upload" type="submit" name="submit3" value="Upload">
<?php
if (isset($_POST['submit3'])) {
$pdf=$_FILES['pdf']['name'];
$pdf_type=$_FILES['pdf']['type'];
$pdf_size=$_FILES['pdf']['size'];
$pdf_tem_loc=$_FILES['pdf']['tmp_name'];
$pdf_store="pdf/".$pdf;
// $mail = $_SESSION['mail'];
$cid = $_SESSION['courseID'];
$tid = $_SESSION['teacherID'];
$lec = $_SESSION['lecture'];
$nem = $_SESSION['nem'];
$type = $_SESSION['type'];
move_uploaded_file($pdf_tem_loc,$pdf_store);
$sql="INSERT INTO course(teacherID, lecture, pdf, name, C_ID, type) values($tid,$lec,'$pdf','$nem',$cid, '$type')";
$query=mysqli_query($conn,$sql);
echo "<script>window.location.href='teacherProfile.php'</script>";
}
?>
</form>
</div>
</body>
</html>