There are different ways of uploading image in database in php. The below code is uploading the image and instead of keeping the image in database, it sets the location of image in database e.g: image/gallery/picture1.jpg . The advantage of this approach is that, it reduces the load in database by reducing the size from image size to text size(instead of uploading images, it upload path to that image). Below is a working code for uploading image.