php - Saving multiple image input using InterventionImage


Trying to make an photo uploader using Intervention\Image I have this in [email protected] :

public function SavePhoto($photo){
        $file_ext = $photo->getClientOriginalExtension();
        $file_name = uniqid();
        $photo_name = $file_name. '.' . $file_ext;
        $path = public_path('uploads/photos/' . $photo_name);
        Image::make($photo)->resize(300, null, function ($constraint) {
        return $photo_name;

public function store(Request $request)

        $observation = new Observation();
        $observation->content = $request['Observation'];
        $observation->status_id = $request['Status'];
        $photo = Input::file('photo');

        foreach ($photo as $p){


I am so confused of how to call the SavePhoto() method for all photos input.




According to the Laravel API docs use the allFiles() method to get the files of$request.

$photos = $request->allFiles();
foreach ($photos as $photo){

I haven't tried it though. :)
its the equivalent of getting the $_FILES array

foreach($_FILES as $photo) {

People are also looking for solutions to the problem: javascript - form not being submitted laravel


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.