Skip to Content
0
Oct 27, 2014 at 08:45 AM

SAP UI5 FileUploader

651 Views

Hello All,

I have read a lot of discussions about file-uploader and tried to do a simple csv upload.

Unfortunately, I am stuck with some issue and unable to resolve it.

My requirements are:

  • Upload a single CSV file.
  • Validate the content of the file in the back-end(I mean in the HANA XS Engine).
  • Show the validation results in the client-browser.

What has been done:

  • UI5 file-uploader control(sap.ui.unified.FileUploader) used to upload the file.
  • uploadOnChange="false", sendXHR="true", useMultipart="false" etc. We insert the "X-CSRF-Token" in the header parameters before uploading.
  • .XSJS service receives the file content and does necessary validation and response is a JSON object. I see the response of the request when checking the request object.

What are the problem, I face:

  1. Along with the response we have error that's thrown in the console saying "Uncaught TypeError: Cannot read property 'documentElement' of null FileUploader.js:26 x.onreadystatechange". The "uploadComplete" event is not triggered. I am expecting this event to be triggered where I plan to process the response.
  2. When I set the fileType="csv" or/and mimeType="text/csv". The "typeMissmatch" isn't triggered when I upload some other file and I see the following error " Uncaught TypeError: undefined is not a function FileUploader.js:30

sap.ui.unified.FileUploader.handlechange FileUploader.js:30

Q.extend.proxy.p sap-ui-core.js:16

Q.event.dispatch sap-ui-core.js:27

Q.event.add.v3.handle sap-ui-core.js:27"

I am not sure what I am missing and how I can resolve.

Any help is much appreciated.

Thanks and Best regards,

Chatur