It is most definately not the correct way.
Instaed, store the images on disk and put only the name and location into the database.
That way you can search the database to find the image you want, and you can print a direct link the HTML, which saves you a lot of time.