Add file upload

This commit is contained in:
Bruno Rybársky 2024-04-25 10:48:02 +02:00
parent 8e51278f41
commit 8c471ca067

@ -131,10 +131,9 @@ function parseIncomingFiles(): array
$success = true; $success = true;
print_r($incomingFiles); print_r($incomingFiles);
foreach ($incomingFiles as $incomingFile) { foreach ($incomingFiles as $incomingFile) {
echo "a:" . ($incomingFile["error"] == 0 ? "A" : "B") . "b:" . (is_file($incomingFile["tmp_name"]) ? "A" : "B");
if ($incomingFile["error"] == 0 && is_file($incomingFile["tmp_name"])) { if ($incomingFile["error"] == 0 && is_file($incomingFile["tmp_name"])) {
$type = explode("/", $incomingFile["type"]); $type = explode("/", $incomingFile["type"]);
if ($type == "image") { if (str_starts_with($type, "image")) {
echo "Adding " . $incomingFile["name"]; echo "Adding " . $incomingFile["name"];
$imgFname = pathinfo($incomingFile["name"], PATHINFO_FILENAME); $imgFname = pathinfo($incomingFile["name"], PATHINFO_FILENAME);
$uploadPath = getUploadPath("image", $imgFname); $uploadPath = getUploadPath("image", $imgFname);