-
Notifications
You must be signed in to change notification settings - Fork 0
/
upload.php
54 lines (42 loc) · 2.26 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
<?php
// include "dbLogic.php";
// if (isset($_REQUEST['new_img'])){
// $image = $_FILES['img-input'];
// $imgOrder = $_REQUEST['img_order'];
// $imgName = $_FILES['img-input']['name'];
// $imgTmpName = $_FILES['img-input']['tmp_name'];
// $imgSize = $_FILES['img-input']['size'];
// $imgError = $_FILES['img-input']['error'];
// $imgType = $_FILES['img-input']['type'];
// $fileExt = explode('.', $imgName); // gets the extension of the file i.e. image.jpg so extensions will have jpg only
// $fileActualExtension = strtolower(end($fileExt)); // this converts fileExt like "JPG" to "jpg" for fair compatison
// $extensions = array('jpg', 'jpeg', 'png', 'pdf');
// if (in_array($fileActualExtension, $extensions)){
// if($imgError === 0){
// if($imgSize < 1000000000){
// $imgNameNew = uniqid("IMG-", true).".".$fileActualExtension;
// $imgDestination = "uploads/".$imgNameNew;
// move_uploaded_file($imgTmpName, $imgDestination);
// // --------------------------
// include_once('imgResize.php');
// $targetfile = "uploads/".$imgNameNew;
// $resizedfile = "uploads/resized_".$imgNameNew;
// $width = 860;
// $height = 600;
// resize_image($targetfile, $resizedfile, $width, $height, $fileActualExtension);
// //---------------------------
// // Insert into db
// $sql = "INSERT INTO images(image_order, image) VALUES('$imgOrder','$imgNameNew ')";
// mysqli_query($conn, $sql);
// header('Location: banner.php?uploaded');
// } else {
// echo "Your file is too large";
// }
// } else {
// echo 'There was an error uploading the file';
// }
// } else {
// echo 'you cannot upload files of this type';
// }
// }
?>