cancel
Showing results for 
Search instead for 
Did you mean: 

File parsing with a service and sap.ui.unified.FileUploader. Problem in IE

0 Kudos

Hi all!
I have faced with a strange behavior of a FileUpload control in IE.
I have a service for file parsing. I should send a file from a client on a server and receive json data in response.

Code example:


<script>

  var fu = new sap.ui.unified.FileUploader({

               id:"__uploader999",

               uploadUrl : "/_service_/parse",

               uploadOnChange : true,

               fileType : "csv",

               maximumFileSize : 1,

               buttonOnly : true,

               icon : "sap-icon://upload",

                uploadComplete : [ function(oEvent) {

                           alert(oEvent.getParameter("response"))

                 }, this ],

                 typeMissmatch : [ function(oEvent) {

                           sap.m.MessageToast.show("typeMissmatch");

                 }, this ],

                 fileSizeExceed : [ function(oEvent) {

                           sap.m.MessageToast.show("fileSizeExceed");

                 }, this ],

                 fileAllowed : [ function(oEvent) {

                           sap.m.MessageToast.show("fileAllowed");

                 }, this ],

                 uploadProgress : [ function(oEvent) {

                            sap.m.MessageToast.show("uploadProgress");

                 }, this ],

                 uploadAborted : [ function(oEvent) {

                                sap.m.MessageToast.show("uploadAborted");

                 }, this ],

                 filenameLengthExceed : [ function(oEvent) {

                           sap.m.MessageToast.show("filenameLengthExceed");

                 }, this ]

            })

       fu.placeAt("content");

</script>

It works fine in Chrome and I have a data in responseComplete.
But IE9 and IE10 saves the response automatically and responseComplete event doesn't fire.

May someone have faced this?


Thanks in advance!

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos
former_member182374
Active Contributor
0 Kudos

Hi Raman,

I've a similar problem to yours: http://scn.sap.com/thread/3837313

My java code looks like this:


JSONObject j = new JSONObject();

j.put("status", "200");

j.put("fileName", fileName + "." + fileExt);

String utfString = j.toString();

          

//response.setHeader("Content-Type", "application/json; charset=UTF-8");

//response.setHeader("Content-Type", "text/html; charset=UTF-8");

//response.setContentType("application/json");

response.setHeader("Content-Type", "text/plain; charset=UTF-8");

          

//response.setContentType("text/plain");

//response.setContentType("text/html");

          

if (utfString != null) {

    try {

        utfString = new String(utfString.getBytes("UTF-8"),"UTF-8");

    } catch (UnsupportedEncodingException e) {

        throw new RuntimeException("Error writing to response", e);

    }

}

          

response.getWriter().write(utfString);

I can see the correct response in the browser but I cannot access the response from the control event 'uploadComplete'.

Can you please share your code?

Regards,

Omri

Answers (3)

Answers (3)

0 Kudos

+ response in Chrome
(1) Network->parse->Response  -  json format
(2) on uploadComplete  function - string with <pre>

former_member182372
Active Contributor
0 Kudos

Raman, post response headers from that service "/_service_/parse"

0 Kudos

Hi Maksim,

kammaje_cis
Active Contributor
0 Kudos

Raman,

Not specifically this issue, but I have encountered similar issues (browser version specific) with various File upload controls.

First thing you can do is to ensure you have the latest UI5 library on the server. That solved most issues for me.

After that it is trial and error and lots of luck.

0 Kudos

Hi Krishna,
thank you for your advice, I forgot to check the latest version!

... but update to v. 1.28.4 didn't fix the issue.