Преглед на файлове

Merge pull request #936 from joanhey/FILES-full_path

Add $_FILES['full_path']
walkor преди 2 години
родител
ревизия
f18ae19c31
променени са 2 файла, в които са добавени 9 реда и са изтрити 3 реда
  1. 2 2
      src/Events/EventInterface.php
  2. 7 1
      src/Protocols/Http/Request.php

+ 2 - 2
src/Events/EventInterface.php

@@ -21,7 +21,7 @@ interface EventInterface
      * Delay the execution of a callback.
      * @param float $delay
      * @param callable $func
-     * @param array $args
+     * @param mixed[] $args
      * @return int
      */
     public function delay(float $delay, callable $func, array $args = []): int;
@@ -37,7 +37,7 @@ interface EventInterface
      * Repeatedly execute a callback.
      * @param float $interval
      * @param callable $func
-     * @param array $args
+     * @param mixed[] $args
      * @return int
      */
     public function repeat(float $interval, callable $func, array $args = []): int;

+ 7 - 1
src/Protocols/Http/Request.php

@@ -593,6 +593,7 @@ class Request
             }
             [$key, $value] = explode(': ', $contentLine);
             switch (strtolower($key)) {
+
                 case "content-disposition":
                     // Is file data.
                     if (preg_match('/name="(.*?)"; filename="(.*?)"/i', $value, $match)) {
@@ -613,7 +614,7 @@ class Request
                         }
                         $uploadKey = $fileName;
                         // Parse upload files.
-                        $file = [...$file, 'name' => $match[2], 'tmp_name' => $tmpFile, 'size' => $size, 'error' => $error];
+                        $file = [...$file, 'name' => $match[2], 'tmp_name' => $tmpFile, 'size' => $size, 'error' => $error, 'full_path' => $match[2]];
                         if (!isset($file['type'])) {
                             $file['type'] = '';
                         }
@@ -626,9 +627,14 @@ class Request
                         $postEncodeString .= urlencode($k) . "=" . urlencode($boundaryValue) . '&';
                     }
                     return $sectionEndOffset + strlen($boundary) + 2;
+                
                 case "content-type":
                     $file['type'] = trim($value);
                     break;
+
+                case "webkitrelativepath":
+                    $file['full_path'] = \trim($value);
+                    break;
             }
         }
         if ($uploadKey === false) {