HTML 5 File API 0x80004003

0

Hi i am using the JS HTML5 File API to handle file uploads to my server.

I am getting the following error in Aurora(Fire Fox Bleeding edge builds)

NS_ERROR_INVALID_POINTER: Component returned failure code: 0x80004003 (NS_ERROR_INVALID_POINTER) [nsIDOMFileReader.readAsBinaryString]

function readBlob(opt_startByte, opt_stopByte,file,partNo) {

    var start = parseInt(opt_startByte);
    var stop = parseInt(opt_stopByte);
    var reader = new FileReader();

    var totalParts = parseInt(file.size/MAX_READ);
    if((file.size % MAX_READ) !== 0){
        totalParts++;
    }
    // If we use onloadend, we need to check the readyState.
    reader.onloadend = function(evt) {
        if (evt.target.readyState == FileReader.DONE) {
            //var contents =  reader.result;
            postFilePart(partNo,contents,totalParts,escape(file.name))// DONE == 2
        }
    };
    if (file.webkitSlice) {
        var blob = file.webkitSlice(start, stop);
    } else if (file.mozSlice) {
        var blob = file.mozSlice(start, stop);
    }
    reader.readAsBinaryString(blob);
}

the error is occurring at this line

reader.readAsBinaryString(blob);

i have tried mozSlice and Slice

if (file.mozSlice) { var blob = file.mozSlice(start, stop); }

and it gave me the same results. it might not be the best idea to use HTML 5 API yet as this may cause issues with other browsers as well.

does anyone have a work around to get the same functionality or how i can resolve this particular error

javascript
html5
file
asked on Stack Overflow Jul 24, 2012 by Billybonks • edited Apr 9, 2013 by Rob

1 Answer

0

Solved the issue it it was rerunning the reader code with incorrect parameters due to a mistake on the calling method

https://bugzilla.mozilla.org/show_bug.cgi?id=725289

rather use slice vs mozSlice

answered on Stack Overflow Jul 24, 2012 by Billybonks

User contributions licensed under CC BY-SA 3.0