Unable to retrieve blob from SQL database in IE11

  • JavaScript
  • Thread starter aheight
  • Start date
  • #1
aheight
320
108
Hi,

I am storing a blob in my database running wamp64/MySQL and I am using AJAX to retrieve it. The code works with Chrome, Edge, and FireFox but I obtain the error message "Invalid State Error" in the debugger for the line "xmlhttp.responseType='arraybuffer'" when I run it under IE11. I have used FileReader with responseType='blob' to read the blob but get a similar error so I just took out the FileReader. I've googled the error message but could not figure out how to solve the problem. I was wondering if someone could help me get my code to work with IE11. This is my Javascript:
JavaScript:
       xmlhttp = new XMLHttpRequest();
 
       xmlhttp.responseType='arraybuffer';
 
      xmlhttp.onreadystatechange = function()
      {
        if (this.readyState == 4 && this.status == 200)
        {
           theResponse=this.response;
           theBlobSize=theResponse.byteLength;
       
          // start type-casting the blob here
       }
     }
    xmlhttp.open("POST","getImagAlgebraicBlob.php",true);
    xmlhttp.send();

And the PHP code for getImagAlgebraicBlob.php uses PDO and is very simple:

PHP:
<?php

include 'algebraicFunctionBlobClass.php';

$blobObj = new algebraicFunctionBlob();

$a = $blobObj->selectImagBlob(132);

echo $a['imagWebGLData'];

?>
 

Answers and Replies

  • #2
Psinter
275
787
It is a bug and it was not fixed for IE11 because it is not within that place's team control. There are no indications of them planning to fix it for that browser. Even on Edge they marked it as NOT REPRODUCIBLE despite it being the most basic example that could be provided.

You could tell the people visiting your site using those browsers that the site is incompatible due to a very old bug that was not fixed in them and suggest that they use another browser.

Or you could use jQuery. If you decide to use jQuery, you could try this:
JavaScript:
$.ajax({
  method: "POST",
  url: "getImagAlgebraicBlob.php",
})
  .done(function(returnedResponse ) {
    //Convert 'returnedResponse' into an Uint8Array so that an ArrayBuffer can be used
    theResponse = new Uint8Array(returnedResponse);
    theBlobSize = theResponse.prototype.buffer.byteLength;
  });

Edit: code comment edited
 
Last edited:
  • Like
Likes harborsparrow and aheight
  • #3
36,854
8,888
  • Like
Likes QuantumQuest, Psinter and aheight
  • #4
aheight
320
108
Outstanding guys! Yes, I tried the work-around setting responseType after xhr.open() and it worked. Thanks a bunch guys for helping me with setting up all the pieces to get this software up and running!
 

Suggested for: Unable to retrieve blob from SQL database in IE11

Replies
13
Views
288
  • Last Post
Replies
8
Views
567
  • Last Post
2
Replies
51
Views
2K
Replies
17
Views
681
  • Last Post
Replies
14
Views
851
Replies
16
Views
836
Replies
3
Views
1K
  • Last Post
Replies
8
Views
1K
Top