-
Notifications
You must be signed in to change notification settings - Fork 0
/
save.php
executable file
·32 lines (25 loc) · 963 Bytes
/
save.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
<?php
header ( "Access-Control-Allow-Origin: *" );
header ( "Access-Control-Allow-Methods: GET, POST, PUT, DELETE" );
header ( "Access-Control-Allow-Headers: X-Requested-With" );
header ( 'Content-Type: application/json; charset=utf-8' );
if(isset($_GET['langfrom']))
$langfrom = $_GET['langfrom'] ;
else
$langfrom = "" ;
if(isset($_GET['langto']))
$langto = $_GET['langto'] ;
else
$langto = "" ;
foreach(array('video', 'audio') as $type) {
if (isset($_FILES["${type}-blob"])) {
$fileName = $_POST["${type}-filename"];
$uploadDirectory = "uploads/$fileName";
if (!move_uploaded_file($_FILES["${type}-blob"]["tmp_name"], $uploadDirectory)) {
echo("problem moving uploaded file");
}
exec('/home/ubuntu/.nvm/versions/node/v6.11.2/bin/node /home/ubuntu/Project-X/translate.js ' . $fileName . ' ' . $langfrom . ' ' . $langto . ' >> log.txt');
echo "?play=" . $fileName ;
}
}
?>