-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupload_str.php
48 lines (40 loc) · 1.1 KB
/
upload_str.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
<?php
include 'rand.php';
include 'config.php';
if(isset($_POST['str'])){
$error = false;
$success = false;
$errortext = "";
$successtext = "";
$allowedExts = array("jpg", "jpeg", "gif", "png", "mp3", "mp4", "wma","str");
$extension = pathinfo($_FILES["file"]["name"], PATHINFO_EXTENSION);
if (in_array($extension, $allowedExts))
{
if ($_FILES["file"]["error"] > 0)
{
$error = true;
$errortext = "Return Code: " . $_FILES["file"]["error"] . "<br />";
}
else
{
move_uploaded_file($_FILES["file"]["tmp_name"],
"str/" . $_FILES["file"]["name"]);
$id = $_POST['str'];
$file = $_FILES["file"]["name"];
$sql = "UPDATE `files` SET `str`='$file' WHERE upload_id = '$id'";
echo "$sql";
$result = $db->query($sql);
if($result){
$success = true;
$successtext = "uploaded " . $_FILES["file"]["name"] . "<br/> translation available in 1 hour. <br/>THANKS! ";
header("location: adminpannel.php");
}
}
}
else
{
$error = true;
$errortext = "Invalid file";
}
}
?>