Big files take unjustly long time to submit from the form Laravel PHP

62 Views Asked by At

I am creating a project using Laravel PHP, which requires selecting a video file from form and submitting it to controller function for further processing. But I came across this issue that those video files take a lot of time just to submit, e.g. 600MB video takes about 10-15 minutes just to reach the controller, and I am required to upload video files up to 3GB ...

Before writing this question I studied multiple threads on different forums and came across the solutions where it would be required to increase values of post_max_size, upload_max_filesize & memory_limit, so I did that. With the help of phpinfo() I found out that in my Laravel project has "Loaded Configuration File" from D:\wamp\bin\php\php8.1.10\php.ini. So I opened the file and changed all the aforementioned fields to 3000M:

post_max_size = 3000M
upload_max_filesize = 3000M
memory_limit = 3000M

I made sure that those settings applied by checking in phpinfo().

Here's the config: phpinfo()

But this did not fix the issue, file submission still takes an unjustly long time.

web.php

Route::post('/add-video', [App\Http\Controllers\VideosController::class, 'createVideo'])->name('createVideo');

Form:

{{ Form::open(['route' => 'createVideo', 'method' => 'post', 'id' => 'videoForm', 'files' => true, 'enctype' => 'multipart/form-data']) }}
  {{ Form::file('video'); }}
  {{ Form::submit('Add Video') }}                                
{{ Form::close() }}

Controller function (basically does nothing at this point, since the problem is with file submission and NOT with processing logic):

public function createVideo(Request $request)
{
    var_dump($request->video);
}

Would also like to note that the same action in a simple WAMP project (with the same php.ini config), would usually take not more than 5 seconds. Both projects would run on the same hardware, with the same configuration, the only difference is that one of them is based on Laravel ...

0

There are 0 best solutions below