jeudi 12 octobre 2017

Laravel 5 getting the hash of an uploaded image

I upload an image and I am trying to get the hash of the image in a variable without saving the images.

foreach($request->only('photos') as $files){
    foreach ($files as $file) {
        if(is_file($file)) {
            $fname = $file->getClientOriginalName();

            $hash = file_get_contents($fname));

            dd($hash);
        }
    }
}

I keep getting this error:

"file_get_contents(1.jpg): failed to open stream: No such file or directory"

Anyone knows how I can fix this?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire