I have upgraded my PHP to 5.6 from 5.4 and now I can't get an image extension because Input::get('file') returns null. I have not touched the code, only upgraded the PHP.
I use Laravel 4.2
$input = Input::all();
$rules = array(
'file' => 'image|max:3000',
);
$validation = Validator::make($input, $rules);
if ($validation->failed())
{/*
return Response::make($validation->errors->first(), 400);*/
return Response::json(['error' => $validation->errors->first()]);
}
$image = Input::file('file');
$filename = time() . '.' . $image->getClientOriginalExtension();
$path = public_path('images/temp/' . $filename);
Image::make($image->getRealPath())->save($path);
Session::put('topicCover', $path);
return Response::json(['status' => 'success', 'filename' => $filename]);
I found out that error occures after the line "Image::make($image->getRealPath())->save($path);" Maybe that is because after xampp reinstallation it does not allow apache to move files from xampp\temp to my folder?