Hewwo UwU

Fluffy's test website on uploading images to a database!

Your Image uploaded successfully!

"; }elseif ($query["r"] == "fail") { echo "

F, Upload failed

"; }elseif ($query["r"] == "nofile") { echo "

No file lol

"; }elseif ($query["r"] == "del") { echo "

Deleted file

"; }elseif ($query["r"] == "nodel") { echo "

Could not delete file

"; }else{ echo "

Select an image to upload

"; } // My terrible workaround for not being able to show deletion status up here if (isset($_GET['d'])) { echo "

Image ".$_GET['d']." has been modified, view status here

"; } // Attempt database connection $conn = mysqli_connect("localhost", "uwu", "password", "swag"); // If connecton failed, notify user if (!$conn) { echo "

Could not connect to database

"; } if (isset($_POST['upload'])) { // Get image name $get_image_name = $_FILES['image']['name']; // If image present, continue if ($get_image_name != "") { // Set file path for image upload $image_path = "images/".basename($get_image_name); $sql = "INSERT INTO swag_table (imagename) VALUES ('$get_image_name')"; // Uploading image to Table mysqli_query($conn, $sql); // Checking if image uploaded if (move_uploaded_file($_FILES['image']['tmp_name'], $image_path)) { header("Location:index.php?r=epic"); }else{ header("Location:index.php?r=fail"); } }else{ // No image present header("Location:index.php?r=nofile"); } } ?> "; } ?> Successfully deleted: ".$file_name."/".$_GET['d']."

"; } }else{ // Could not delete from file echo "

Failed to delete or no file under the name: ".$file_name." ".$_GET['d']."

"; } } ?>