-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsave_video.php
31 lines (29 loc) · 1.02 KB
/
save_video.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
<?php
date_default_timezone_set('Asia/Manila');
require_once 'conn.php';
if(ISSET($_POST['save'])){
$file_name = $_FILES['video']['name'];
$file_temp = $_FILES['video']['tmp_name'];
$file_size = $_FILES['video']['size'];
if($file_size < 50000000){
$file = explode('.', $file_name);
$end = end($file);
$allowed_ext = array('avi', 'flv', 'wmv', 'mov', 'mp4');
if(in_array($end, $allowed_ext)){
$name = date("Ymd").time();
$location = 'video/'.$name.".".$end;
if(move_uploaded_file($file_temp, $location)){
mysqli_query($conn, "INSERT INTO `video` VALUES('', '$name', '$location')") or die(mysqli_error());
echo "<script>alert('Video Uploaded')</script>";
echo "<script>window.location = 'index2.php'</script>";
}
}else{
echo "<script>alert('Wrong video format')</script>";
echo "<script>window.location = 'index2.php'</script>";
}
}else{
echo "<script>alert('File too large to upload')</script>";
echo "<script>window.location = 'index2.php'</script>";
}
}
?>