Store in GIT

This commit is contained in:
2026-06-17 15:42:16 +02:00
parent 9950ec87ac
commit 90f27d4516
47 changed files with 19559 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
<?php
require("../../inc/connect.php");
$relative_dir = "../../";
$name = $_POST['name'];
$project = $_POST['project'];
$uid = $_POST['uid'];
$filename = basename($_FILES["file"]["name"]);
//Get the directory name
$query = "SELECT `uid` FROM project WHERE `id`=$project";
$temp = ExecQuery($query);
$result = $temp->fetch_assoc();
$dir = $relative_dir . "download/" . $result['uid'];
$target_file = $dir . "/" . $filename;
//Create the directory
if (! file_exists($dir)) {
mkdir($dir, 0755, true);
}
$extension = pathinfo($target_file,PATHINFO_EXTENSION);
//Try to move the file
if (! move_uploaded_file($_FILES["file"]["tmp_name"], $target_file)) {
header("Location: /ptf-admin/add?success=false");
exit;
}
//Update the database
$stmt = $mysqli->prepare("INSERT INTO file (`name`, `uid`, `file`, `project-id`) VALUES (?,?,?,?)");
$stmt->bind_param("sssi", $name, $uid, $filename, $project);
$stmt->execute();
$stmt->close();
header("Location: /ptf-admin/add?success=true");
?>