Skip to content

Can't open files in Firefox #8

@marcoreni

Description

@marcoreni

I'm trying to build an webapp to open some text files saved in the filesystem. and I decided to use this library to be able to use my app on FF17b (next step will be try to add IndexedDb Shim to enable WebSQL fallback).

My code works fine in Chrome, but I receive an error when I try to open a file on Firefox.

Here is my code:

function onInitFs(fs) {
    fs.root.getFile('/path/to/file.txt', {create: false}, function(fileEntry) {
        fileEntry.file(function (file) {
            var reader = new FileReader();
            reader.onloadend = function (e) {
                //do something
            };
            reader.readAsText(file,'ISO-8859-1');
        },errorHandler);
    }, errorHandler);
}

and the error I receive is :NS_ERROR_FAILURE: Failure arg 0 [nsIDOMFileReader.readAsText]
The line the error refers to is reader.readAsText(file,'ISO-8859-1');

I tried some debugging in Firebug and I discovered that object "file" has correct "name" but size 0, empty type and null "blob_", and nothing more.

Am I doing something wrong or is it a problem with the library?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions