I've implemented file uploading in Laravel 5.5 multiple times before without a problem but yesterday I've encountered a problem.
I have a POST API route /api/v1/media which is protected by 3 middleware ['auth:api', 'auth.active', '2fa'] (the latter two just check if the user account is active and if they've confirmed their OTP).
The controller method validates the input data using the following validation rules:
'meta' => 'required|json',
'media' => 'required|file|mimetypes:video/mp4,image/gif,image/jpeg,image/png'
If the validator passes then I upload the file using
$path = $request->file('media')->store('media', 'public');
The code then hangs here for 60 seconds until it times out. The file I'm trying to upload is ~31kB in size so the request shouldn't take nearly as long to finish.
I've also tried uploading the file using
$path = Storage::putFile('media', $request->file('media'), 'public');
but that didn't change anything.
I'm running the application using php artisan serve.
I've done things the same way in past projects and had no issues. I've also verified my PHP.ini file upload settings are appropriate.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire