In this tutorial, we show you how to save an image file into MongoDB, via GridFS API. The GridFS APIs are able to serve other binary files as well, like video and music files. 1. Save image Code snippets to save an image file into MongoDB, under “photo” namespace, and assign a new “filename” for the saved image. String newFileName = "mkyong-java-image"; File imageFile = new File("c:\\JavaWebHostin