-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupload.php
49 lines (38 loc) · 1.27 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
<?php
use is\prototype\ProcessManager;
use is\prototype\FileManager;
include_once('is/prototype/ProcessManager.php');
include_once('is/prototype/FileManager.php');
/**
* This is not a good example of safe file upload handling.
* For quick and dirty prototyping only.
*/
$uploaddir = '/var/www/prototype/PHPAudioEdit/uploads/';
$clipdir = '/var/www/prototype/PHPAudioEdit/clips/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
$clippedfile = $clipdir . basename($_FILES['userfile']['name']);
echo '<pre>';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Possible file upload attack!\r\n";
}
$fm = new FileManager();
$upload_size = $fm->display_filesize($_FILES['userfile']['size']);
echo 'Here is some more debugging info:';
print_r($_FILES);
echo 'Uploaded file size: ' .$upload_size ."\r\n";
$command = "ffmpeg -ss 10 -t 6 -i " .$uploadfile ." " .$clippedfile;
echo "Running " .$command .", Please Wait............\r\n";
$pm = new ProcessManager($command);
while(true) {
if($pm->status()) {
continue;
}
else{
echo "Clipped file successfully! It can be found in your clips directory.\r\n";
break;
}
}
print "</pre>";
?>