File tree Expand file tree Collapse file tree 2 files changed +13
-10
lines changed Expand file tree Collapse file tree 2 files changed +13
-10
lines changed Original file line number Diff line number Diff line change 22
33namespace Laravel \Octane \Listeners ;
44
5+ use Illuminate \Support \Arr ;
56use SplFileInfo ;
67
78class FlushUploadedFiles
@@ -13,16 +14,18 @@ class FlushUploadedFiles
1314 */
1415 public function handle ($ event ): void
1516 {
16- foreach ($ event ->request ->files ->all () as $ file ) {
17- if (! $ file instanceof SplFileInfo ||
18- ! is_string ($ path = $ file ->getRealPath ())) {
19- continue ;
20- }
17+ foreach ($ event ->request ->files ->all () as $ files ) {
18+ foreach (Arr::wrap ($ files ) as $ file ) {
19+ if (! $ file instanceof SplFileInfo ||
20+ ! is_string ($ path = $ file ->getRealPath ())) {
21+ continue ;
22+ }
2123
22- clearstatcache (true , $ path );
24+ clearstatcache (true , $ path );
2325
24- if (is_file ($ path )) {
25- unlink ($ path );
26+ if (is_file ($ path )) {
27+ unlink ($ path );
28+ }
2629 }
2730 }
2831 }
Original file line number Diff line number Diff line change @@ -22,8 +22,8 @@ public function test_files_removed()
2222 ];
2323
2424 ($ request = Request::create ('http://127.0.0.1:123/foo ' ))->files ->add ([
25- new UploadedFile ($ file1path , Str::random ()),
26- new UploadedFile ($ file2path , Str::random ()),
25+ [ new UploadedFile ($ file1path , Str::random ())] ,
26+ [ new UploadedFile ($ file2path , Str::random ())] ,
2727 new UploadedFile ($ file3path , Str::random ()),
2828 ]);
2929
You can’t perform that action at this time.
0 commit comments