I am sending multiple images to an API but the way I do it sends it as an object but I need to send it as a URL.
State:
const [files, setFiles] = useState([]);
Image uploader:
const fileSelectHandler = (e) => {
setFiles([...files, ...e.target.files]);
};
<input
type="file"
className="form-control"
id="customFile"
multiple
onChange={fileSelectHandler}
/>
Expected sending package:
"pic": [
{
"url": "760634d2-f8ec-4caa-9a2d-14a8828cfb5dpetplace.jpg"
},
{
"url": "760634d2-f8ec-4caa-9a2d-14a8828cfb5dpetplace.jpg"
}
]