3v4l.org

run code in 300+ PHP versions simultaneously
<?php // file_upload.php if ($_SERVER['REQUEST_METHOD'] == 'POST') { $uploadDir = "uploads/"; if (!is_dir($uploadDir)) { mkdir($uploadDir, 0777, true); // create folder if not exists } $fileName = basename($_FILES['userfile']['name']); $targetFile = $uploadDir . time() . "_" . $fileName; // unique filename if (move_uploaded_file($_FILES['userfile']['tmp_name'], $targetFile)) { echo "✅ File uploaded successfully!<br>"; echo "Stored as: " . htmlspecialchars($targetFile); } else { echo "❌ File upload failed!"; } } else { ?> <form enctype="multipart/form-data" method="POST"> <input type="file" name="userfile" required> <button type="submit">Upload File</button> </form> <?php } ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 45
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 15
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 36, Position 2 = 43
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 44
Branch analysis from position: 44
1 jumps found. (Code = 42) Position 1 = 46
Branch analysis from position: 46
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 43
1 jumps found. (Code = 42) Position 1 = 46
Branch analysis from position: 46
Branch analysis from position: 15
Branch analysis from position: 45
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DFkY7
function name:  (null)
number of ops:  47
compiled vars:  !0 = $uploadDir, !1 = $fileName, !2 = $targetFile
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   FETCH_R                      global              ~3      '_SERVER'
          1        FETCH_DIM_R                                      ~4      ~3, 'REQUEST_METHOD'
          2        IS_EQUAL                                                 ~4, 'POST'
          3      > JMPZ                                                     ~5, ->45
    4     4    >   ASSIGN                                                   !0, 'uploads%2F'
    5     5        INIT_FCALL                                               'is_dir'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $7      
          8        BOOL_NOT                                         ~8      $7
          9      > JMPZ                                                     ~8, ->15
    6    10    >   INIT_FCALL                                               'mkdir'
         11        SEND_VAR                                                 !0
         12        SEND_VAL                                                 511
         13        SEND_VAL                                                 <true>
         14        DO_ICALL                                                 
    9    15    >   INIT_FCALL                                               'basename'
         16        FETCH_R                      global              ~10     '_FILES'
         17        FETCH_DIM_R                                      ~11     ~10, 'userfile'
         18        FETCH_DIM_R                                      ~12     ~11, 'name'
         19        SEND_VAL                                                 ~12
         20        DO_ICALL                                         $13     
         21        ASSIGN                                                   !1, $13
   10    22        INIT_FCALL                                               'time'
         23        DO_ICALL                                         $15     
         24        CONCAT                                           ~16     !0, $15
         25        CONCAT                                           ~17     ~16, '_'
         26        CONCAT                                           ~18     ~17, !1
         27        ASSIGN                                                   !2, ~18
   12    28        INIT_FCALL                                               'move_uploaded_file'
         29        FETCH_R                      global              ~20     '_FILES'
         30        FETCH_DIM_R                                      ~21     ~20, 'userfile'
         31        FETCH_DIM_R                                      ~22     ~21, 'tmp_name'
         32        SEND_VAL                                                 ~22
         33        SEND_VAR                                                 !2
         34        DO_ICALL                                         $23     
         35      > JMPZ                                                     $23, ->43
   13    36    >   ECHO                                                     '%E2%9C%85+File+uploaded+successfully%21%3Cbr%3E'
   14    37        INIT_FCALL                                               'htmlspecialchars'
         38        SEND_VAR                                                 !2
         39        DO_ICALL                                         $24     
         40        CONCAT                                           ~25     'Stored+as%3A+', $24
         41        ECHO                                                     ~25
   12    42      > JMP                                                      ->44
   16    43    >   ECHO                                                     '%E2%9D%8C+File+upload+failed%21'
    3    44    > > JMP                                                      ->46
   20    45    >   ECHO                                                     '%3Cform+enctype%3D%22multipart%2Fform-data%22+method%3D%22POST%22%3E%0A++++%3Cinput+type%3D%22file%22+name%3D%22userfile%22+required%3E%0A++++%3Cbutton+type%3D%22submit%22%3EUpload+File%3C%2Fbutton%3E%0A%3C%2Fform%3E%0A'
   24    46    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.41 ms | 1008 KiB | 19 Q