Skip to Content

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

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!

Capture.PNG (24.2 kB)
Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    Posted on May 12, 2015 at 12:20 PM
    Add a comment
    10|10000 characters needed characters exceeded

    • 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

  • Posted on May 08, 2015 at 04:32 PM

    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. 😊

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 08, 2015 at 06:06 PM

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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 11, 2015 at 08:07 AM

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


    json.jpg (25.9 kB)
    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.