DEV Community

Discussion on: Best way to store images on server

Collapse
 
mashebang profile image
mashebang!

It saves on your computer because the whole environment is your computer. if you install and run the application on a server, it will save it on the server local disk.

btw, you can convert your image file to a base64 string and store it using mongo as a simples string value. but it will be a veeeery large string.

Collapse
 
siddharthshyniben profile image
Siddharth

Just don't forget to compress it – lzw (sample) works great, but you could always put together a custom one (maybe based on the fact that base64 strings contain only a limited subset of characters)

Collapse
 
rusty_xx profile image
Grey_W I N D

I recently worked on a tutorial video from javascriptmastery. I saw how he stored image in base64 string. But what I am trying to do is build my back-end api. So those images can be hosted. For instance, making a get request to this route ...localhost:5000/api/v1/productid/imageName. Brings out that particular image for that product. Just something I've seen and wanted to try out