samedi 6 juillet 2019

Upload file in Laravel - wrong path

I am beginner in Laravel. I have this code:

if ($request->hasfile('profilePhoto')) {
            $this->validate($request, [
                'profilePhoto' => 'required',
                'profilePhoto.*' => 'mimetypes:image/jpg'
            ]);
            $image = $request->file('profilePhoto');
            $extension = strtolower($image->getClientOriginalExtension());
            $path = 'upload/images/UserImage/';
            $uniqueName = md5($image . time());
            $image->move(public_path($path), $uniqueName . '.' . $extension);
        }

This function upload file to public/upload/images/UserImage/ I need change it to storage/app/upload/images/UserImage/

How can I repeair my code?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire