getPhoto laravel

public function getPhoto(Request $request)
{    $photo = new \App\Photo();
    if ($file = $request->image) {        list($type, $imageData) = explode(';', $request->image);
        list(, $extension) = explode('/', $type);
        list(, $imageData) = explode(',', $imageData);
        $fileName = uniqid() . '.' . $extension;
        $source = fopen($request->image, 'r');
        $destination = fopen('images/' . $fileName, 'w');
        stream_copy_to_stream($source, $destination);
        fclose($source);
        fclose($destination);
        $photo = \App\Photo::create(['name' => $fileName]);
        return $photo;
    }    return $photo;
}



No comments:

What is Security Engineering? Part 2.

A broad overview of the ever-developing security engineering field; a domain that can feel intimidating to some software engineers. With Nie...

Contact Form

Name

Email *

Message *