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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:22:14+00:00 2026-06-18T06:22:14+00:00

Many sites these days have ‘theming’ functionality, when user is able to customize the

  • 0

Many sites these days have ‘theming’ functionality, when user is able to customize the pages’ look. Sometimes it’s only a fixed set of themes, but sometimes people are free to choose any style they want – for example, they can set up any color of the pages’ background.

I want to go a step further – and let them choose the background image as well. The flow is very simple: user uploads a file (via <input type="file" />), then this file becomes a background image – but only for this user.

I can’t find anything about this functionality online, though, and I have no clue about what to do.

Something else I was thinking was that, if a user selects a background, maybe I could use HTML5 localstorage to make that background come up every-time that visitor visits the page.

  • 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-18T06:22:15+00:00Added an answer on June 18, 2026 at 6:22 am

    Here’s a proof of concept (mostly based on the code given at MDN FileReader doc page + this answer):

    HTML:

    <input id="test" type="file" onchange="loadImageFile(this)" />
    

    JS: no wrap (head) mode

    $(switchBackground);
    var oFReader = new FileReader(),
        rFilter = /^(?:image\/bmp|image\/cis\-cod|image\/gif|image\/ief|image\/jpeg|image\/jpeg|image\/jpeg|image\/pipeg|image\/png|image\/svg\+xml|image\/tiff|image\/x\-cmu\-raster|image\/x\-cmx|image\/x\-icon|image\/x\-portable\-anymap|image\/x\-portable\-bitmap|image\/x\-portable\-graymap|image\/x\-portable\-pixmap|image\/x\-rgb|image\/x\-xbitmap|image\/x\-xpixmap|image\/x\-xwindowdump)$/i;
    
    oFReader.onload = function(oFREvent) {
        localStorage.setItem('b', oFREvent.target.result);
        switchBackground();
    };
    
    function switchBackground() {
      var backgroundImage = localStorage.getItem('b');
      if (backgroundImage) {
        $('body').css('background-image', 'url(' + backgroundImage + ')');    
      } 
    }
    
    function loadImageFile(testEl) {
      if (! testEl.files.length) { return; }
      var oFile = testEl.files[0];
      if (!rFilter.test(oFile.type)) { alert("You must select a valid image file!"); return; }
      oFReader.readAsDataURL(oFile);
    }
    

    And here’s a working demo, checked in latest Firefox and Chrome versions. Looks to work OK, at least. )

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

Sidebar

Related Questions

Many sites have scripts similar to the one below. These are put to stop
Was just wondering how do these sites (and many other softwares that generate flash
I've noticed many sites are able to use a username or page title as
I have seen on many sites the silverlight video player. I noticed that all
I want to know the disadvantages of scanf() . In many sites, I have
Please help, clarify this issue, I have seen it on many sites now, you
I am starting to create my sites in Ruby on Rails these days instead
I have seen many sites that are responsive both on desktop browsers and mobile
I have been reading a lot about MVC these days and I think I
I am looking to be able to track how many a days a given

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.