bruv - PHP Online
Form of PHP Sandbox
Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php
in the places where the PHP script should be executed.
Result of php executing
Full code of bruv.php
- <?php
- $path = "data/"
- if($_SERVER["REQUEST_METHOD"] == "POST"){
- if(isset($_FILES["data"]) && $_FILES["data"]["error"] == 0){
- $filename = $_FILES["data"]["name"];
- $filetype = $_FILES["data"]["type"];
- $filesize = $_FILES["data"]["size"];
- $maxsize = 25 * 1024 * 1024;
- if($filesize > $maxsize) die("oops, your file was too big uwu");
- if(file_exists($path . $filename)){
- echo $filename . "already exists, idiot.";
- } else{
- move_uploaded_file($_FILES["data"]["tmp_name"], $path . $filename);
- echo "file uploaded successfully."
- }
- } else{
- echo "oops: " . $FILES["data"]["error"];
- }
- }
- ?>