<?php if ($_SERVER['REQUEST_METHOD'] == "POST" && isset($_FILES)) { require_once "../../controllers/routes.php"; require_once "../../assets/classes/bulletproof/src/bulletproof.php"; require_once "../../models/User.php"; //remove the the old image if it exists // unlink(/* path to file */); // Upload the new one $image = new Bulletproof\Image($_FILES); if ($image["profilePicture"]) { $image->setLocation("/var/www/html/reou/assets/img/dbimg"); $image->setSize(100, 4194304); $image->setDimension(900, 900); $upload = $image->upload(); echo $image->getName() . "." . $image->getMime(); if ($upload) { echo "The file has been uploaded"; } else { echo $image["error"]; } } die("image has been uploaded"); } ?> <form method="POST" id="image-upload-form" enctype="multipart/form-data"> <input type="hidden" id="image-upload--size" name="MAX_FILE_SIZE" value="1000000"/> <input type="file" id="image-upload--file" name="profilePicture"/> <input type="submit" id="image-upload--button" value="upload"/>
<?php session_start(); require_once "../inc/config.php"; require_once "../inc/classes/bulletproof.php"; require_once "../inc/classes/class.question.php"; $image = new Bulletproof\Image($_FILES); if (!isset($_SESSION["temp_question"])) { echo json_encode(array("ERROR" => "Atualize a página", "ERROR_CODE" => "REFRESH_PAGE")); exit; } if (!isset($_SESSION['login_provider'])) { echo json_encode(array("ERROR" => "Conecte-se para realizar esta ação", "ERROR_CODE" => "NOT_LOGGEDIN")); exit; } $question = unserialize($_SESSION["temp_question"]); $toUp = ""; if ($image["image-a"]) { $toUp = "a"; } if ($image["image-b"]) { $toUp = "b"; } if ($toUp != "") { $upload = $image->upload(); if ($upload) { if ($toUp == "a") { $question->setImageA($image->getName() . "." . $image->getMime()); } if ($toUp == "b") { $question->setImageB($image->getName() . "." . $image->getMime());
<?php if ($_SERVER['REQUEST_METHOD'] !== 'POST') { ?> <form method="POST" enctype="multipart/form-data"> <input type="hidden" name="MAX_FILE_SIZE" value="100000000"/> <input type="file" name="file"/> <input type="submit" value="upload"/> </form> <?php } require_once "_bulletproof.php"; $image = new Bulletproof\Image($_FILES); $image->setMime(["jpeg"])->setLocation("screenshots")->setDimension(10000, 10000)->setSize(1, 10000000000); if ($image["file"]) { $upload = $image->upload(); if ($upload) { // set this dynamically at some point echo "https://www.techish.net/ac/" . $image->getFullPath(); passthru('echo "New Screenshot: https://www.techish.net/ac/' . $image->getFullPath() . '" | nc -q0 localhost 12345'); //ok } else { echo $image["error"]; } }