For my project, I am utilizing an Uploader component from RSuite to upload images to the Express server:
<Uploader action={process.env.REACT_APP_API_URL + '/loadMap'} draggable headers={{Authorization: 'Bearer ' + localStorage.getItem('token')}} name="map">
<div style={{ width: '100%', height: 300, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
<span>Click or Drag map image to this area to upload</span>
</div>
</Uploader>
Although the request reaches the Express server when I upload an image, I am unable to locate the content of the uploaded image. In the IncomingMessage Request, I cannot find attributes like 'files', 'file', or any other containing the picture's content:
exports.loadMap = async (req, res, next) => {
let mapContent = req.body.map;
let mapFile = req.file;
}
Could someone guide me on how to retrieve and save this content on the server? Your help is greatly appreciated. Thank you.