0
votes

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?

1
Can you please show us the code ? - Saiyan Prince
@user3514160 updated the question - naneri

1 Answers

0
votes

Ok, found the answer - I have not enabled the fileinfo extension after upgrading PHP. Great facepalm...