I'm using Laravel 5.1 and php 7. I try to implement an image upload. Large images fails to upload. (A white screen appears with no error message) I tested it locally on xampp and on a webspace. With small images it works. It fails with an image of 2.5MB but the max value is 5000.
My controller:
public function fileUpload(Request $request)
{
if($request->hasfile('filename'))
{
foreach($request->file('filename') as $image)
{
$targetFolder = public_path().'/images/';
$name=$image->getClientOriginalName();
$extension = $image->getClientOriginalExtension(); // add
$picture = sha1($name . time()) . '.' . $extension; //add
$image->move($targetFolder, $picture);
$image = \Intervention\Image\Facades\Image::make(sprintf('images/%s', $picture))->resize(640, null, function ($constraint) {
$constraint->aspectRatio();
});
$image->sharpen(10);
$image->save();
$form= new Image();
$form->filename = $picture;
$form->appartement_id = $appartement->id;
$form->save();
}
}
return back()->with('success', 'Your images has been successfully');
}
The questions:
- Why there is no error message? Only a white screen appears when it fails to upload. (Maybe there is a necessary configuration to do in one of the laravel config files?
- Why it works with smaller images? Where in xampp and on the webspace it's a configuration necessary?
According to my phpinfo file, I have the following values defined: (Local on xampp)
post_max_size = 8M
upload_max_filesize = 10M
On my webspace each is 200M. This values should be high enough?