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

  • SEARCH
  • Home
  • 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 9299849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T22:39:17+00:00 2026-06-18T22:39:17+00:00

I have a webapp that is saving images locally until they are ready to

  • 0

I have a webapp that is saving images locally until they are ready to be sent to the server. When I save the images locally, I base64 encode them. Now I want to do a multipart file upload with these images.

So I need to convert the image back into binary form. I’ve tried using the FileReader to convert it back like this,

var fr = new FileReader();
fr.onloadend = function(binaryImage){
    debugger;
    binaryImage;
};
var base64Str = item.base64Image.substr(item.base64Image.indexOf("base64") + 7);
//var base64Str = item.base64Image;
fr.readAsBinaryString(base64Str);

but the onloadend event is never fired and there are no errors. Once I get the image I wont have trouble uploading it. Any ideas?

Thanks!

  • 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-18T22:39:18+00:00Added an answer on June 18, 2026 at 10:39 pm

    Not to familiar with FileReader, but I believe readAsBinaryString is expecting a Blob or File object. Passing it a string causes errors on my end. Try this:

    var fr = new FileReader();
    fr.onloadend = function(binaryImage){
        debugger;
        binaryImage;
    };
    var blob = new Blob([item.base64Image.
                              substr(item.base64Image.indexOf("base64") + 7)]);
    fr.readAsBinaryString(blob);
    

    I don’t think this will give you want though. Check out this article for ways to encode/decode Base64: How can you encode to Base64 using Javascript?

    Looks like you can use btoa() and atob() for web kit browsers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a fairly large webapp that I run on a Media Temple server.
I have Java webapp that I developed locally with m2eclipse + Jetty + eclipse,
I have a webapp that lists all of my artists, albums and songs when
I have an iPhone WebApp that is installed to the home page. When a
I have a Django webapp that has both a front-end, web-accessible component and an
multiple webapp running on same tomcat using same jvm. sometime, one webapp that have
I have a Java EE webapp that works perfectly when I run it on
I have a GWT (+GAE) webapp that allows users to edit Customer entities. When
I am working toward a small webapp that I would like to have a
I have a maven3 webapp (war) project that has 2 dependencies. One is a

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.