-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathchangeprofilepic.php
87 lines (43 loc) · 1.42 KB
/
changeprofilepic.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
85
86
87
<?php
include'core/init.php';
protect_page();
?>
<?php include'includes/overall/header.php';
?>
<div class="profilepic">
<?php
if(isset($_FILES['profile'])===true){
if(empty($_FILES['profile']['name'])===true){
echo 'Please Choose a file!';
}
else{
//
$allowed=array('jpeg','jpg','png','gif');
$file_name=$_FILES['profile']['name'];
$file_extn= strtolower(end(explode('.',$file_name)));
$file_temp=$_FILES['profile']['tmp_name'];
$file_size=$_FILES['profile']['size'];
if(in_array($file_extn,$allowed)===true){
user_profile_image($session_user_id,$file_temp,$file_extn);
header('Location:'.$current_file);
}
else{
echo 'Incorrect File Type. Allowed: ';
echo implode(',',$allowed);
}
}
}
if(empty($user_data['profile'])===false){
echo '<img src="',$user_data['profile'],'" alt="',$user_data['first_name'],'\'s Profile Image" >';
}
?>
<form action=" " method="POST" enctype="multipart/form-data">
<p>Select The Best Pic of yours :</p><br>
<input type="file" name="profile">
<input type="submit" name="Submit">
</form>
<?php
?>
</div>
<?php
include 'includes/overall/footer.php';?>