Am trying to upload images in laravel 8 but for large files this fails.
In my controller i have the following
public function uploadTemporaryFile(Request $request)
{
$request->validate([
'image' => 'required|mimes:png,jpeg,jpg',
])
$file = $request->file('image');
//do more stuff here
}
The above works for smaller image files but large image files 8MB validation fails. After a bit of troubleshooting and logging the $request on large files i found this to be
var_dump($request);
array (
'image' =>
Illuminate\Http\UploadedFile::__set_state(array(
'test' => false,
'originalName' => 'IMG_20201203_072650.jpg',
'mimeType' => 'application/octet-stream',
'error' => 1,
'hashName' => NULL,
)),
)
As per above the large image file the mime type seems to change from image/jpeg to application/octet-stream. The same code used to upload small images is used to upload large image files.
With the application/octet-stream the $request->file("image") is now empty.
How can i get the uploaded file for saving when its a large image file. Or what am i missing.
I have also adjusted both upload_max_filesize and post_max_size to 100M each.