I want to save uuid on backend with image name I already save Image name on backend by clicking the button ( HandleCreate ) you show I my code :
const HandleCreate = async (e) => {
e.preventDefault();
obj['urlToImage'] = image.name;
const res = await axios.post('API',obj )
};
and this is my input code:
<input
type="file"
style={{ opacity: "0%" }}
htmlFor="fileInput"
id="urlToImage"
name="myImage"
onChange={(e)=>( handleInput(e))}
accept="image/*"
/>
and the handleInput you show in onChange function in define below :
const handleInput = (e) => {
console.log(e);
let name = e.target.id;
obj[name] = e.target.value;
console.log(obj[name]);
};
this is total code now I dont understand where i put this uuid so when I save image id will also save with name tis is uuid code :
const unique_id = uuid();
I hope some one show me sample