-
Notifications
You must be signed in to change notification settings - Fork 0
/
response.php
executable file
·56 lines (50 loc) · 1.88 KB
/
response.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
<?php
header('Access-Control-Allow-Origin: https://conference.eastus.cloudapp.azure.com:8081');
session_start();
//====================================================
// Uploading a recorded video or audio file to server
//----------------------------------------------------
if ($_GET['action'] == 'upload') {
//if (!is_dir("uploads/")) mkdir("uploads/");
if (!is_dir("Data/")) mkdir("Data/");
if (isset($_FILES["blob"])) {
$tempName = $_FILES["blob"]["tmp_name"];
$destination = "Data/".$_FILES["blob"]["name"];
file_put_contents($destination, file_get_contents($tempName,'r'),FILE_APPEND);
}
/*if (isset($_FILES["${type}-bloab"])) {
$tempName = $_FILES["${type}-blob"]["tmp_name"];
$destination = "uploads/".$_FILES["${type}-blob"]["filename"];
file_put_contents($destination, file_get_contents($tempName,'r'),FILE_APPEND);
echo $filename;
}*/
/*echo $type;
foreach(array('video', 'audio') as $type) {
if (isset($_FILES["${type}-blob"])) {
echo 'uploads/';
$fileName = $_POST["${type}-filename"];
$uploadDirectory = 'uploads/'.$fileName;
echo($_FILES["${type}-blob"]["tmp_name"]);
if (!move_uploaded_file($_FILES["${type}-blob"]["tmp_name"], $uploadDirectory)) {
echo("problem moving uploaded file");
}
$tempName = $_FILES["${type}-blob"]["tmp_name"];
//file_put_contents($fileName, file_get_contents($tempName,'r'),FILE_APPEND);
echo($fileName);
}
}*/
echo "success";
}
//====================================================
// Checking if formatted data files exist
//----------------------------------------------------
else if ($_GET['action'] == 'checkformatteddata') {
$dataKey = $_GET["dataKey"];
$mergedFile = "uploads/$dataKey-merge.webm";
if (file_exists($mergedFile)) {
echo "true";
} else {
echo "Continuing to process data...";
}
}
?>