-
Notifications
You must be signed in to change notification settings - Fork 1
/
adminphoto.php
84 lines (60 loc) · 1.72 KB
/
adminphoto.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
75
76
77
78
79
80
81
82
83
84
<html>
<head>
<title> adminphoto page </title>
</head>
<body>
<center><h2>image </h2></center>
<form method="post" action ="adminphoto.php" enctype="multipart/form-data">
<div>
<center><label><b>image</b></label>
<input type="file" name="image" required></center></br>
</div>
<center><div class="sub" ><center>
<input type="submit" name="submit" value="submit"/></center>
</div></center>
</body>
</html>
<?php
$image="";
$tempname="";
if(isset($_POST['submit']))
{
$image=$_FILES["image"]["name"];
$imagetype=$_FILES["image"]["type"];
$filetype=explode( "/","$imagetype");
if(isset($_FILES['image']))
{
$maxsize = 2097152;
$acceptable = array(
'image/jpeg',
'image/jpg',
'image/gif',
'image/png');
if(($_FILES['image']['size'] >= $maxsize) || ($_FILES["image"]["size"] == 0)) {
?>
<script>
alert('file size out of limit');
window.open('adminphoto.php','_self');
</script>
<?php
}
else
{
// Create connection
$password=md5($password);
$conn=mysqli_connect("localhost","root","","eventmanage");
$uploaddir="/opt/lampp/htdocs/eventmanagement/adminphoto/";
//$uploaddir='includes/dataimage.php/';
$uploadfile = $uploaddir . basename($_FILES['image']['name']);
move_uploaded_file($_FILES['image']['tmp_name'], $uploadfile);
$sql="INSERT INTO adminimage(image) VALUES ('$image')";
$run=mysqli_query($conn,$sql);
if ($run != TRUE) {
echo "Error: ";
/* <center><label><b>id</b></label>
<input type="text" placeholder="enter id" name="id" required></center></br>*/
}
}
}
}
?>