Posts

Showing posts from December, 2020

How to store images to server in base64 string format

Image
In Today's time, many web application revolves around images or images are the core part of the application and handling image upload and storing on the server and in the database has been a complex task from the beginning. In this article, we will have a look at the Reactjs component to convert image files to base64 string and storing that string on the server-side without maintaining a separate folder for storing uploaded images. Command to install the package:      npm install  react-file-base64   Advantages: It doesn't require setting  enctype ="multipart/form-data"  for uploading image files to the server. It does not require to set headers: {Content-Type:'application/JSON'} while making a post request to API and sending an image to API. On the server-side, it doesn't require to maintain a separate folder to store all image to it. It doesn't require setting the file path to the specified folder. It doesn't require setting the file name by