-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathuploader_script.php
56 lines (49 loc) · 1.47 KB
/
uploader_script.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
ini_set('upload_max_filesize', '200M');
ini_set('post_max_size', '180M');
extract($_POST);
if(isset($_FILES['file'])){
$errors= array();
$file_name = $_FILES['file']['name'];
$file_size = $_FILES['file']['size'];
$file_tmp = $_FILES['file']['tmp_name'];
$file_type = $_FILES['file']['type'];
$value=explode('.',$_FILES['file']['name']);
$file_ext=strtolower(end($value));
$expensions= array("bsp");
$name=pathinfo($file_name,PATHINFO_FILENAME);
if(in_array($file_ext,$expensions)=== false){
echo "<script>
spop({
template: 'Error! Only .bsp files < 200Mb allowed',
group: 'submit-satus',
position : 'top-right',
style: 'error',
autoclose: 2000
});</script>";
$errors[]="extension not allowed, please choose a .bsp file.";
}
if($file_size > 1024*200*1024) {
echo "<script>
spop({
template: 'Error! Only .bsp < 200Mb allowed',
group: 'submit-satus',
position : 'top-right',
style: 'error',
autoclose: 2000
});</script>";
$errors[]='File size must be less than 200 MB';
}
if(empty($errors)==true) {
move_uploaded_file($file_tmp,"lava/tf/maps/".$file_name);
echo "<script>
spop({
template: 'Success! File uploaded',
group: 'submit-satus',
position : 'top-right',
style: 'success',
autoclose: 2000
});</script>";
}
}
?>