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)
{
$this->validate($request, [
'image' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:5000',
]);
$image = $request->file('image');
$input['imagename'] = time().'.'.$image->getClientOriginalExtension();
$destinationPath = public_path('/images');
$image->move($destinationPath, $input['imagename']);
$this->postImage->add($input);
return back()->with('success','Image Upload successful');
}
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?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire