kevinwakhisi's avatar

Saving Image

I would like an authenticated user to save their files in a directory attached to their user id or user name so far this is my uploads controller for the directory

public function upload(Request $request)
    {
        $this->validate($request, [
            'file' => 'required|mimes:jpeg,jpg,png',
        ]);
        $picName = time() . '.' . $request->file->extension();
        $request->file->move(public_path('uploads/img/profiles'), $picName);
        return $picName;
    }

so intern i would like to have a directory after profiles to be the name or id of the user where they will store or upload their images or files. Please help

0 likes
2 replies

Please or to participate in this conversation.