how to read xml from body nextJS api route

Viewed 7

I am using PrimeReact 8.5 fileUpload and NextJS 12.3 How do I get just the XML sent from PrimeRact?

I upload the file with

<FileUpload
            name="edcStock"
            url="/api/admin/edcupload"
            onUpload={onUpload}
            accept="text/xml"
            maxFileSize={1000000}
/>

In nextjs API I get the file body with

export default function handler(req:      NextApiRequest, res: NextApiResponse) {
const { body } = req;
console.log(body);
return res.status(200).json({ message: 'called api' });
 }

The body is reported as

------WebKitFormBoundarysugaJxeQVSrDx1AH
Content-Disposition: form-data;    name="edcStock"; filename="edc_xml_en_test.xml"
Content-Type: text/xml

<?xml version="1.0" encoding="UTF-8"?>
<products>
 <product>
   <id>32</id>
0 Answers
Related