I currently have a form that takes in a couple inputs. One of them is an image that I also need to save to a database.
I dont know if this works but my current idea to do this is to use Imgurs API to upload and retrieve the url for said image. Then store that url into my database.
I never had to work with image uploads so this all new to me. In my <input type=file>
, I logged the value and I see a path to the image that looks something like this: C:\fakepath
.
I am using React and was storing the input values in the state so I could validate the values. I would then call another function that would make an API request to my backend but obviously the file path for the image isnt correct.
How do I pass the actual path to my backend?