-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhome_upload.php
More file actions
43 lines (40 loc) · 1.56 KB
/
home_upload.php
File metadata and controls
43 lines (40 loc) · 1.56 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
<?php
require 'connection.php';
/*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Form to let the admin add new images to the gallery on the home page. Implemented by Abhinav Tripathi.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
if(adloggedin()){
$structure = 'images/frame_demo';//images for gallery are stored in "images/frame_demo" folder
$filename = $structure;
if(isset($_FILES['choose_file1'])){
$name1 = $_FILES['choose_file1']['name'];
$tmp1 = $_FILES['choose_file1']['tmp_name'];
$type1 = $_FILES['choose_file1']['type'];
$ext1 = strtolower(substr(($name1),strpos($name1,'.')+1));
if(isset($name1)){
if(!empty($name1)){
echo 'OK'.'<br>';
$location_pic = $structure.'/';
echo $location_pic;
// Upload routine
if(($ext1=='png'|| $ext1=='jpeg'|| $ext1=='jpg') && move_uploaded_file($tmp1,$location_pic.$name1)){
echo 'successfully uploaded1';
}else{
echo 'Error occurred while uploading11 '.$name1.' </br>Please choose a jpeg or png file';
}
}else{
echo 'No File was chosen1';
}
}
}
//form for uploading
echo'
<form action="home_upload.php" method ="post" enctype="multipart/form-data">
<input type="file" name="choose_file1" id="choose_file1" class="form-control" placeholder="corners file"><br><br>
<input type="submit" name="upload">
</form><br>
';
}
else{
echo 'Please login to upload files';
}