dmcglone27's avatar

getClientOriginalName entering tmp name in db

Hey all, I'm trying to upload an image and enter it's name into the db and everything works well except instead of entering the file name into the db it's putting the /tmp/bla.png into the db when I want the name of the file. I can't figure out why this is doing this. Can anyone see what Is going wrong here? Here's my controller:

public function update(Request $request, $id)
    {
        $album = Album::findOrFail($id);
        umask(0);
        File::cleanDirectory('images/cover_photos/' . $id);
        $imageName = $request->file('album_cover')->getClientOriginalName();
        $request->file('album_cover')->move('images/cover_photos/' . $id, $imageName, 0777);
        $album->update($request->all());
        return redirect()->back();
    }
0 likes
0 replies

Please or to participate in this conversation.