-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
69 lines (61 loc) · 1.93 KB
/
index.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
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
extract($_POST);
if(isset($_FILES['file']['name']))
{
if($_FILES['file']['name']!='')
{
@$ext = end(explode(".", strtolower($_FILES['file']['name'])));
$target_file = "images/" . $_FILES["file"]["name"];
if(move_uploaded_file($_FILES["file"]["tmp_name"], $target_file))
{
if($ext == 'mp4' || $ext == 'webm' || $ext == 'ogg')
{
$img = '<video width="50%" height="50%" controls>
<source src="'.$target_file.'" type="video/mp4">
<source src="'.$target_file.'" type="video/ogg">
<source src="'.$target_file.'" type="video/webm">
</video>';
}
else
{
$img = "<img src='$target_file' height='500' width='500'>";
}
}
}
$rezultat = urlencode($img);
echo '<body onload="parent.doneloading(\''.$rezultat.'\')"></body>';
}
?>
<script src="https://code.jquery.com/jquery-3.3.1.js" integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60="crossorigin="anonymous"></script>
<script>
function doneloading(rezultat)
{
rezultat = decodeURIComponent(rezultat.replace(/\+/g, " "));
document.getElementById('showimg').innerHTML = rezultat;
document.getElementById('showimg').style.transform=50+deg;
}
</script>
<script type="text/javascript">
$(function()
{
$("#file").change(function()
{
$("#form1").submit();
setStatus("showimg");
return false;
});
function setStatus(theloc)
{
var tag = document.getElementById(theloc);
if (tag)
{
tag.innerHTML = '<img src="images/icons/loading.gif" width="36" height="31" style="margin-top:45px; margin-left:45px;" />';
}
}
});
</script>
<form method="post" action="<?php $_SERVER['PHP_SELF'];?>" enctype="multipart/form-data" id="form1" target="uploadframe">
<input type="file" name="file" id="file">
<div id="showimg"></div>
<iframe id="uploadframe" name="uploadframe" src="#" width="8" height="8" scrolling="no" frameborder="0" ></iframe>
</form>