Skip to content

Commit 57e4aca

Browse files
committed
uploaded file
1 parent 3d18bf1 commit 57e4aca

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/Illuminate/Foundation/Http/TypedFormRequestFactory.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Illuminate\Foundation\Http\Attributes\WithoutInferringRules;
1919
use Illuminate\Foundation\Precognition;
2020
use Illuminate\Http\Request;
21+
use Illuminate\Http\UploadedFile;
2122
use Illuminate\Support\Arr;
2223
use Illuminate\Support\Collection;
2324
use Illuminate\Support\Facades\Date;
@@ -30,6 +31,7 @@
3031
use ReflectionParameter;
3132
use ReflectionType;
3233
use ReflectionUnionType;
34+
use SplFileInfo;
3335
use stdClass;
3436

3537
use function Illuminate\Support\enum_value;
@@ -624,6 +626,10 @@ protected function ruleForNonBuiltinType(ReflectionNamedType $type): mixed
624626
return 'array';
625627
}
626628

629+
if ($this->isFile($name)) {
630+
return 'file';
631+
}
632+
627633
return null;
628634
}
629635

@@ -637,6 +643,14 @@ protected function isDateObjectType(string $name): bool
637643
return is_a($name, DateTimeInterface::class, true);
638644
}
639645

646+
/**
647+
* @return bool
648+
*/
649+
protected function isFile(string $name): bool
650+
{
651+
return is_a($name, SplFileInfo::class, true);
652+
}
653+
640654
/**
641655
* Cast the given value to the requested date object type.
642656
*

0 commit comments

Comments
 (0)