-
Notifications
You must be signed in to change notification settings - Fork 1
/
reuploadFile.php
executable file
·76 lines (60 loc) · 1.84 KB
/
reuploadFile.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
70
71
72
73
74
75
76
<?php
ob_clean();
ini_set('display_errors', 'On');
error_reporting(E_ALL);
require_once("util.php");
function error($eNum = NULL)
{
}
if ($_SERVER['REQUEST_METHOD'] == "POST")
{
if (!canUpload())
{
echo "E:UP_PERM<br>";
echo "LOOKS LIKE YOU NEED TO LOG IN OR REGISTER TO UPLOAD!";
return false;
}
if (!isFileOwner($_POST["fileID"]))
{
echo "E:NOT_OWNER<br>";
echo "YOU CAN'T MODIFY FILES THAT AREN'T YOURS!";
return false;
}
$fileData = getFileInfo($_POST["fileID"]);
$f = new UploadedFile($fileData["FilePath"], $_FILES["fileSingle"]['tmp_name'], $_FILES["fileSingle"]["size"], $_FILES["fileSingle"]['error'], NULL, NULL, NULL);
$redirect = true;
$f->validateFileForErrors();
if (isset($_POST["unlisted"]))
$f->setUnlisted();
if ($f->type == File::$types["MOVIE"])
{
echo "MOVIE!!! MAY TAKE TIME TO CONVERT";
}
$result = $f->storeFile(true);
updateFile($_POST["fileID"]); //TODO Make way to change file name
if ($result !== true)
$redirect = false;
//header("Refresh:30; URL=http://www.vadweb.us/files.php");
echo $result."<br>";
echo "<h1> ERROR!!! </h1>";
echo "Printing info for " . $key . ": <br>";
echo "     " . $f->name . "<br>";
echo "     " . $f->nameNoEXT . "<br>";
echo "     " . $f->extension . "<br>";
echo "     <h2> Please note this error code: " . $f->uploadError . "</h2><br>";
echo "     " . $f->type . "<br>";
echo "     " . $f->size . "<br>";
echo "     " . $f->absPath . "<br>";
echo "<br>";
if ($result > 0) {
echo "<strong> Successfully wrote to folder file number: " . $key . "</strong><br>";
echo "<a href='files.php'> Return to files page </a>";
}
if ($redirect)
{
ob_clean();
header("Location: /files.php?s=t");
}
gc_enable();
}
?>