That takes care of the upload part - then you just need to load the image into the database (which the code you posted doesn’t show).
It is usually recommended that the image also be kept as a file as that is much faster to access. The database copy would serve as a backup so that the file can be recreated if anything happens to it - deleted or corrupted or whatever.