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 6916779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:38:49+00:00 2026-05-27T09:38:49+00:00

The idea is to take an image from a user’s machine and allow them

  • 0

The idea is to take an image from a user’s machine and allow them to display the image in a webpage. I do not want to send the image back to the server.

An upload button will exist. It should just update the page content dynamically.

Can this be done with HTML5 localstorage or anything?

  • 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-05-27T09:38:49+00:00Added an answer on May 27, 2026 at 9:38 am

    FileReader is capable of doing this. Here’s sample code:

    <input type="file" id="files" name="files[]" multiple />
    <img id="image" />
    
    <script>
        function onLoad(evt) {
            /* do sth with evt.target.result - it image in base64 format ("data:image/jpeg;base64,....") */
            localStorage.setItem('image', evt.target.result);
            document.getElementById('image').src = evt.target.result;
        };
    
        function handleFileUpload(evt) {
            var files = evt.target.files; // FileList object
    
            for (var i = 0; i < files.length; i++) {
                var f = files[i];
    
                // Only process image files.
                if (!f.type.match('image.*')) {
                    continue;
                }
    
                var reader = new FileReader();
                reader.onload = onLoad;
                reader.readAsDataURL(f);
            }
        }
    
        document.getElementById('files').addEventListener('change', handleFileUpload, false);
    
        var image = localStorage.getItem('image');
        if (image !== null) {
            document.getElementById('image').src = image;
        }
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is probably crazy. I want to take the idea of Dependency Injection to
I was recently struck by a curious idea to take input from /dev/urandom, convert
I want to crop an image retrieved from the database. I found the following
The basic idea is to take a string and evaluate it against an XML
I want to get the maximum values from two images, while preserving other information.
I have a java application that will take the image as an input and
I'm trying to take an image, optimize it as a 65% jpeg and save
I want to create gallery application which would get thumbnails and metadata from web
I have an app that I have been developing that can display sensitive user
I am trying to pull the latest five image thumbs from my booru datebase

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.