File tree Expand file tree Collapse file tree 5 files changed +36
-0
lines changed Expand file tree Collapse file tree 5 files changed +36
-0
lines changed Original file line number Diff line number Diff line change 22
33## [ Unreleased] ( https://github.com/laravel/octane/compare/v1.0.4...1.x )
44
5+ ### Fixed
6+ - Uploaded files moving ([ #317 ] ( https://github.com/laravel/octane/pull/317 ) )
57
68## [ v1.0.4 (2021-06-08)] ( https://github.com/laravel/octane/compare/v1.0.3...v1.0.4 )
79
Original file line number Diff line number Diff line change 1414use Laravel \Octane \Listeners \CollectGarbage ;
1515use Laravel \Octane \Listeners \DisconnectFromDatabases ;
1616use Laravel \Octane \Listeners \EnsureUploadedFilesAreValid ;
17+ use Laravel \Octane \Listeners \EnsureUploadedFilesCanBeMoved ;
1718use Laravel \Octane \Listeners \FlushTemporaryContainerInstances ;
1819use Laravel \Octane \Listeners \ReportException ;
1920use Laravel \Octane \Listeners \StopWorkerIfNecessary ;
6364 'listeners ' => [
6465 WorkerStarting::class => [
6566 EnsureUploadedFilesAreValid::class,
67+ EnsureUploadedFilesCanBeMoved::class,
6668 ],
6769
6870 RequestReceived::class => [
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ // https://github.com/spiral/roadrunner-laravel/issues/43
4+
5+ namespace Symfony \Component \HttpFoundation \File ;
6+
7+ function move_uploaded_file ($ from , $ to )
8+ {
9+ return \is_file ($ from ) && \rename ($ from , $ to );
10+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Laravel \Octane \Listeners ;
4+
5+ class EnsureUploadedFilesCanBeMoved
6+ {
7+ /**
8+ * Handle the event.
9+ *
10+ * @link https://github.com/spiral/roadrunner-laravel/issues/43
11+ *
12+ * @param mixed $event
13+ * @return void
14+ */
15+ public function handle ($ event ): void
16+ {
17+ if (! function_exists ('\\Symfony \\Component \\HttpFoundation \\File \\move_uploaded_file ' )) {
18+ require __DIR__ .'/../../fixes/fix-symfony-file-moving.php ' ;
19+ }
20+ }
21+ }
Original file line number Diff line number Diff line change @@ -112,6 +112,7 @@ protected function bindListeners()
112112 $ this ->app ->singleton (Listeners \EnforceRequestScheme::class);
113113 $ this ->app ->singleton (Listeners \EnsureRequestServerPortMatchesScheme::class);
114114 $ this ->app ->singleton (Listeners \EnsureUploadedFilesAreValid::class);
115+ $ this ->app ->singleton (Listeners \EnsureUploadedFilesCanBeMoved::class);
115116 $ this ->app ->singleton (Listeners \FlushAuthenticationState::class);
116117 $ this ->app ->singleton (Listeners \FlushQueuedCookies::class);
117118 $ this ->app ->singleton (Listeners \FlushSessionState::class);
You can’t perform that action at this time.
0 commit comments