-
Notifications
You must be signed in to change notification settings - Fork 1
/
saveMeta.php
executable file
·41 lines (32 loc) · 1.28 KB
/
saveMeta.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
<?php
include_once("CONSTANTS.php");
$movie = new movie($_POST['contentId']);
foreach ($_POST as $key => $value) {
if($key != "contentId") {
if($key == "image" && $value != "") {
$movie->hdImg = "roku/$value";
$movie->sdImg = "roku/$value";
} else {
$movie->$key = htmlentities(str_replace('"',"",stripslashes($value)));
}
}
}
$fileElementName = "hdImg";
if (!empty($_FILES[$fileElementName]['error'])) {
error_log("File upload error");
} elseif (empty($_FILES[$fileElementName]['tmp_name']) || $_FILES[$fileElementName]['tmp_name'] == 'none') {
//error_log('No file was uploaded!');
} else {
$movie->hdImg = "roku/images/".rawurlencode($_FILES[$fileElementName]['name']);
$movie->sdImg = "roku/images/".rawurlencode($_FILES[$fileElementName]['name']);
$target_path ='images/';
$target_path = $target_path . basename( $_FILES[$fileElementName]['name']);
move_uploaded_file($_FILES[$fileElementName]['tmp_name'], $target_path);
//for security reason, we force to remove all uploaded file
@unlink($_FILES[$fileElementName]);
}
$movies[] = $movie;
$movieMeta = new videoMetaData();
$movieMeta->writeUpdate($movies);
header("location: /roku?page=".$_POST['page']."&playlistId=".$_POST['playlistId']);
?>