Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8752381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:13:27+00:00 2026-06-13T13:13:27+00:00

I got a strange error while trying to read a local file with FileReader

  • 0

I got a strange error while trying to read a local file with FileReader (I am using Firefox 16.0.2):

[20:57:48.440] reader = new FileReader()
[20:57:48.453] [object FileReader]
--
[20:58:15.104] reader.onload= function(evt) {alert('ok');}
[20:58:15.114] (function (evt) {alert("ok");})
--
[20:58:32.162] reader.readAsText('test.txt');
[20:58:32.170] [Exception... "Could not convert JavaScript argument arg 0 [nsIDOMFileReader.readAsText]"  nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)"  location: "JS frame :: Web Console :: <TOP_LEVEL> :: line 1"  data: no]

Any ideas of how to fix it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T13:13:28+00:00Added an answer on June 13, 2026 at 1:13 pm

    A FileReader takes a File or Blob parameter. Not some kind of string that resembles a file name. The File comes from a drag/drop action of an input type=file.

    See this html5rocks article for more details or the code below for reading images.

    $(function () {
            if (Modernizr.draganddrop) {
                var dropTarget = $('#dropTarget').get(0);
    
                dropTarget.addEventListener('dragover', function (e) {
                    e.preventDefault();
                });
    
                dropTarget.addEventListener('drop', function (e) {
                    e.preventDefault();
    
                    if (e.dataTransfer.files === undefined) {
                        // IE doesn't support file drops yet.
                        $('#dropTarget').text('Drag & Drop of files is not supported');
                        return;
                    }
    
                    $.each(e.dataTransfer.files, function () {
                        var file = this;
                        var reader = new FileReader();
                        reader.onload = function () {
                            $('<img>')
                                .attr('title', file.name)
                                .attr('src', this.result)
                                .css('width', '75%')
                                .appendTo('#images');
                        };
                        reader.readAsDataURL(file);
                    });
                });
            }
            else {
                $('#dropTarget').text('Drag & Drop is not supported');
            }
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have got a strange compile error while using condition operator. a,b are int
I got this strange error on SVN: Error while updating filelist (The path '/path/'
While I was writing some Scala code, I got a strange error message when
I'm getting something pretty strange going on when trying to read some data using
I'm trying to parse html with BeautifulSoup and got strange error. Here's the minimal
I got a strange compiler error when using generics within a for-each loop in
I got a strange error when using netty(with camel), we use LengthFieldBasedFrameDecoder for communication,
I've got a strange error in Rails using Sass/Css: 1p*x isn't a valid CSS
I've got a strange error with IE8 and postcode lookups. It may not be
Well, I´m developing a wpf application and I got a strange error on design

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.