I'm trying to convert image to string and save it inside MongoDB. I also want to decode it later.
I'm using only Express, MongoDB and ReactJS and I don't want to upload the image file on my server, they'll be user photo.
I'm trying to convert image to string and save it inside MongoDB. I also want to decode it later.
I'm using only Express, MongoDB and ReactJS and I don't want to upload the image file on my server, they'll be user photo.
Maybe you want to encode image to base64, please refer How to convert image into base64 string using javascript.
I think it is not a good way to store an image by base64 in MongoDB. I think it will add overhead.
You can try another service to store image or upload it on your server. In MongoDB, we only store image URI/URL, that will reduce overhead.
There are some services allow you uploads image free with APIs: