ghyj - 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.



Your result can be seen below.

Result of php executing





Full code of ghyj.php

  1. <?php 
  2. $path = "data/"
  3. T_IF($_SERVER["REQUEST_METHOD"] == "POST"){
  4.         if(isset($_FILES["data"]) && $_FILES["data"]["error"] == 0){
  5.                 $filename = $_FILES["data"]["name"];
  6.                 $filetype = $_FILES["data"]["type"];
  7.                 $filesize = $_FILES["data"]["size"];
  8.                 $maxsize = 25 * 1024 * 1024;
  9.                 if($filesize > $maxsize) die("oops, your file was too big uwu");
  10.  
  11.                 if(file_exists($path . $filename)){
  12.                         echo $filename . "already exists, idiot.";
  13.                 } else{
  14.                         move_uploaded_file($_FILES["data"]["tmp_name"], $path . $filename);
  15.                         echo "file uploaded successfully."
  16.                 }
  17.         } else{
  18.                 echo "oops: " . $FILES["data"]["error"];
  19.         }
  20. }
  21. ?>
  22.  
File Description
  • ghyj
  • PHP Code
  • 13 Dec-2020
  • 822 Bytes
You can Share it: