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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T09:29:40+00:00 2026-06-16T09:29:40+00:00

In my HTML form I have input filed with type file for example :

  • 0

In my HTML form I have input filed with type file for example :

 <input type="file" multiple>

Then I’m selecting multiple files by clicking that input button.
Now I want to show preview of selected images before submitting form . How to do that in HTML 5?

  • 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-16T09:29:41+00:00Added an answer on June 16, 2026 at 9:29 am

    Here’s a quick example that makes use of the URL.createObjectURL to render a thumbnail by setting the src attribute of an image tag to a object URL:

    The html code:

    <input accept="image/*" type="file" id="files" />
    <img id="image" />
    

    The JavaScript code:

    document.getElementById('files').onchange = function () {
      var src = URL.createObjectURL(this.files[0])
      document.getElementById('image').src = src
    }
    

    The code snippet in the HTML example below filters out images from the user’s selection and renders selected files into multiple thumbnail previews:

    function handleFileSelect (evt) {
      // Loop through the FileList and render image files as thumbnails.
      for (const file of evt.target.files) {
     
        // Render thumbnail.
        const span = document.createElement('span')
        const src = URL.createObjectURL(file)
        span.innerHTML = 
          `<img style="height: 75px; border: 1px solid #000; margin: 5px"` + 
          `src="${src}" title="${escape(file.name)}">`
    
        document.getElementById('list').insertBefore(span, null)
      }
    }
    
    document.getElementById('files').addEventListener('change', handleFileSelect, false);
    <input type="file" accept="image/*" id="files" multiple />
    <output id="list"></output>
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an HTML form that needs multiple submit buttons, like this: <input type=submit
I have this HTML: <form action='uploadhandle.php' method='POST' enctype=multipart/form-data> <input type='file' class='fileinput' id='photo1' name='photo1'> <input
I have a form in a .html files where input/select box looks like this
I have a asp.net form with 5 HTML file input controls with runat=server and
I have a html form <form action=process.php method=post> <input type=checkbox name=name[v1] /> <input type=checkbox
I have a HTML form containing checkboxes in the form of .. <input type=checkbox
I have an HTML form: <form action='process.php' method='post'> <input type='checkbox' name='check_box_1' /> Check me!<br>
I tried to change the HTML form, input type file. Here is my code:
I have a form containing file type input ,but in the design i dont
I have a form with field <input type=file name=file size=100 value=> if this field

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.