I am using PrimeReact 8.5 fileUpload and Next.js 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 Next.js 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>